mirror of
https://github.com/gryf/wmaker.git
synced 2026-08-26 05:31:55 +02:00
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:
committed by
Carlos R. Mafra
parent
412b3eace2
commit
be495bedbc
+8
-1
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user