wmaker: allow the screenshot filename template to be set

This patch is adding a new option ScreenshotFilenameTemplate for users
to change the default strftime format "screenshot_%Y-%m-%d_at_%H:%M:%S".
For example, Teams is not allowing the ':' char in the filename of file
to be shared so I always have to rename the file.
This commit is contained in:
David Maciejak
2026-03-20 10:11:02 +00:00
committed by Carlos R. Mafra
parent 412b3eace2
commit be495bedbc
4 changed files with 38 additions and 1 deletions
+8 -1
View File
@@ -1270,7 +1270,14 @@ void ScreenCapture(WScreen *scr, int mode)
s = time(NULL);
tm_info = localtime(&s);
strftime(filename_date_part, sizeof(filename_date_part), "screenshot_%Y-%m-%d_at_%H:%M:%S", tm_info);
strftime(filename_date_part, sizeof(filename_date_part), wPreferences.screenshot_filename_template, tm_info);
if (strchr(filename_date_part, '/') != NULL) {
wfree(screenshot_dir);
werror(_("Unsafe screenshot filename template, it should not contain a path separator"));
return;
}
strcpy(filename, filename_date_part);
filepath = wstrconcat(screenshot_dir, strcat(filename, filetype));