summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2013-02-13 13:40:58 -0500
committerKristian Høgsberg <krh@bitplanet.net>2013-02-14 16:01:41 -0500
commitc4831be22d801ce34d478b731dd1100d7db78fb5 (patch)
tree371432b384e94e559a6377e8fc224b1ce6c9c3e7
parent033b5df52f41cb330e534b349f9ee2c12cef9522 (diff)
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.
-rw-r--r--clients/screenshot.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/clients/screenshot.c b/clients/screenshot.c
index 8681a41c..c218554d 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");