From c4831be22d801ce34d478b731dd1100d7db78fb5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 13 Feb 2013 13:40:58 -0500 Subject: [PATCH] screenshot: Print warning if we're not launched from weston weston-screenshooter is a helper binary that weston launches to write the screenshot to disk. If somebody tries to launch it by hand, print a warning and mention the screenshot keybinding. --- clients/screenshot.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clients/screenshot.c b/clients/screenshot.c index 8681a41..c218554 100644 --- a/clients/screenshot.c +++ b/clients/screenshot.c @@ -241,6 +241,13 @@ int main(int argc, char *argv[]) struct screenshooter_output *output; int width, height; + if (getenv("WAYLAND_SOCKET") == NULL) { + fprintf(stderr, "%s is must be launched by weston.\n" + "Use the MOD+S shortcut to take a screenshot.", + argv[0]); + return -1; + } + display = wl_display_connect(NULL); if (display == NULL) { fprintf(stderr, "failed to create display: %m\n"); -- 2.7.4