summaryrefslogtreecommitdiff
path: root/desktop/slock/patches/0009-add-option-to-run-command-after-screen-is-locked.patch
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/slock/patches/0009-add-option-to-run-command-after-screen-is-locked.patch')
-rw-r--r--desktop/slock/patches/0009-add-option-to-run-command-after-screen-is-locked.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/desktop/slock/patches/0009-add-option-to-run-command-after-screen-is-locked.patch b/desktop/slock/patches/0009-add-option-to-run-command-after-screen-is-locked.patch
new file mode 100644
index 0000000000..574396a1de
--- /dev/null
+++ b/desktop/slock/patches/0009-add-option-to-run-command-after-screen-is-locked.patch
@@ -0,0 +1,49 @@
+From e867c38123175d6f050e051ee6b00f4737a9712a Mon Sep 17 00:00:00 2001
+From: Markus Teich <markus.teich@stusta.mhn.de>
+Date: Sat, 26 Dec 2015 13:13:25 +0100
+Subject: [PATCH 9/9] add option to run command after screen is locked
+
+---
+ slock.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/slock.c b/slock.c
+index 6be8f22..ddf1074 100644
+--- a/slock.c
++++ b/slock.c
+@@ -289,7 +289,7 @@ lockscreen(Display *dpy, int screen)
+ static void
+ usage(void)
+ {
+- fprintf(stderr, "usage: slock [-v]\n");
++ fprintf(stderr, "usage: slock [-v|POST_LOCK_CMD]\n");
+ exit(1);
+ }
+
+@@ -303,7 +303,8 @@ main(int argc, char **argv) {
+
+ if ((argc == 2) && !strcmp("-v", argv[1]))
+ die("slock-%s, © 2006-2015 slock engineers\n", VERSION);
+- else if (argc != 1)
++
++ if ((argc == 2) && !strcmp("-h", argv[1]))
+ usage();
+
+ #ifdef __linux__
+@@ -339,6 +340,13 @@ main(int argc, char **argv) {
+ return 1;
+ }
+
++ if (argc >= 2 && fork() == 0) {
++ if (dpy)
++ close(ConnectionNumber(dpy));
++ execvp(argv[1], argv+1);
++ die("slock: execvp %s failed: %s\n", argv[1], strerror(errno));
++ }
++
+ /* Everything is now blank. Now wait for the correct password. */
+ #ifdef HAVE_BSD_AUTH
+ readpw(dpy);
+--
+2.6.4
+