aboutsummaryrefslogtreecommitdiff
path: root/system/triggerhappy/rc.triggerhappy
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2020-11-07 08:23:14 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-11-07 08:23:14 +0700
commit4cbe86445404e1b24c8b5ea4295d8b0ae077cd4c (patch)
tree29e30c513f5338231dd8204a2adf7634631e7862 /system/triggerhappy/rc.triggerhappy
parent6f697d0fa5be83f59d01645e452e38432d25b4f9 (diff)
system/triggerhappy: Added (a lightweight global hotkey daemon).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/triggerhappy/rc.triggerhappy')
-rw-r--r--system/triggerhappy/rc.triggerhappy24
1 files changed, 24 insertions, 0 deletions
diff --git a/system/triggerhappy/rc.triggerhappy b/system/triggerhappy/rc.triggerhappy
new file mode 100644
index 0000000000000..d8f3266484bf5
--- /dev/null
+++ b/system/triggerhappy/rc.triggerhappy
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# rc.triggerhappy, sysv-style init script for triggerhappy.
+# part of the slackbuilds.org triggerhappy build.
+
+THD_SOCKET=/var/run/thd.socket
+THD_ARGS="--daemon --user nobody --socket $THD_SOCKET --triggers /etc/triggerhappy/triggers.d/ /dev/input/event*"
+
+case "$1" in
+ ""|"start") if [ -e $THD_SOCKET ]; then
+ echo "$0: $THD_SOCKET already exists (daemon running or stale socket?)"
+ exit 1;
+ fi
+ echo "Starting triggerhappy daemon (thd)"
+ /usr/sbin/thd $THD_ARGS ;;
+ stop) echo "Stopping triggerhappy daemon (thd)"
+ /usr/sbin/th-cmd --socket $THD_SOCKET --quit
+ /bin/rm -f $THD_SOCKET ;;
+ restart) $0 stop ; /bin/sleep 1; exec $0 start ;;
+ *) echo "Usage: $0 [stop|start|restart]"
+ exit 1 ;;
+esac
+
+exit 0