[PATCH weston 3/3] screenshot: save screenshot files in XDG_PICTURES_DIR

Aleksander Morgado aleksander at aleksander.es
Tue Jan 23 00:05:22 UTC 2018


If XDG_PICTURES_DIR not given, it will use the current directory, as
it was before.

Signed-off-by: Aleksander Morgado <aleksander at aleksander.es>

diff --git a/clients/screenshot.c b/clients/screenshot.c
index be8d9fe6..78a5d424 100644
--- a/clients/screenshot.c
+++ b/clients/screenshot.c
@@ -217,7 +217,8 @@ write_png(int width, int height)
 						      CAIRO_FORMAT_ARGB32,
 						      width, height, buffer_stride);

-	fp = file_create_dated("wayland-screenshot-", ".png", filepath, sizeof(filepath));
+	fp = file_create_dated(getenv("XDG_PICTURES_DIR"), "wayland-screenshot-",
+			       ".png", filepath, sizeof(filepath));
 	if (fp) {
 		fclose (fp);
 		cairo_surface_write_to_png(surface, filepath);
--
2.15.1


More information about the wayland-devel mailing list