aboutsummaryrefslogtreecommitdiff
path: root/system
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
parent6f697d0fa5be83f59d01645e452e38432d25b4f9 (diff)
system/triggerhappy: Added (a lightweight global hotkey daemon).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system')
-rw-r--r--system/triggerhappy/README29
-rw-r--r--system/triggerhappy/rc.triggerhappy24
-rw-r--r--system/triggerhappy/slack-desc19
-rw-r--r--system/triggerhappy/test.conf.example10
-rw-r--r--system/triggerhappy/triggerhappy.SlackBuild84
-rw-r--r--system/triggerhappy/triggerhappy.info10
6 files changed, 176 insertions, 0 deletions
diff --git a/system/triggerhappy/README b/system/triggerhappy/README
new file mode 100644
index 000000000000..fc8e62f25f27
--- /dev/null
+++ b/system/triggerhappy/README
@@ -0,0 +1,29 @@
+triggerhappy (a lightweight global hotkey daemon)
+
+Triggerhappy is a hotkey daemon that operates on a system wide
+scale. It watches all configured input devices for key, switch,
+or button events and can launch arbitrary commands specified by the
+administrator. In contrast to hotkey services provided by desktop
+environments, Triggerhappy is especially suited to hardware related
+switches like volume or wifi control; it works independently from
+a specific user being logged in and is also suitable for embedded
+systems that do not have a graphical user interface.
+
+The disadvantage of using triggerhappy is that it must be run with
+root privileges.
+
+After installing the package, you'll want to:
+
+ 1. Read the man page for thd, particularly the EXAMPLES section.
+
+ 2. Create one or more confg files, matching the pattern:
+ /etc/triggerhappy/triggers.d/*.conf
+ See the example files in /etc/triggerhappy/triggers.d/ for ideas.
+
+ 3. chmod +x /etc/rc.d/rc.triggerhappy
+
+ 4. /etc/rc.d/rc.triggerhappy start
+
+After this, the daemon will start on boot. To add devices to the
+running daemon, use th-cmd's --passfd option (not --add, since the
+daemon drops privileges after startup).
diff --git a/system/triggerhappy/rc.triggerhappy b/system/triggerhappy/rc.triggerhappy
new file mode 100644
index 000000000000..d8f3266484bf
--- /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
diff --git a/system/triggerhappy/slack-desc b/system/triggerhappy/slack-desc
new file mode 100644
index 000000000000..49485ed1fbd2
--- /dev/null
+++ b/system/triggerhappy/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+triggerhappy: triggerhappy (a lightweight global hotkey daemon)
+triggerhappy:
+triggerhappy: Triggerhappy is a hotkey daemon that operates on a system wide
+triggerhappy: scale. It watches all configured input devices for key, switch,
+triggerhappy: or button events and can launch arbitrary commands specified by the
+triggerhappy: administrator. In contrast to hotkey services provided by desktop
+triggerhappy: environments, Triggerhappy is especially suited to hardware related
+triggerhappy: switches like volume or wifi control; it works independently from
+triggerhappy: a specific user being logged in and is also suitable for embedded
+triggerhappy: systems that do not have a graphical user interface.
+triggerhappy:
diff --git a/system/triggerhappy/test.conf.example b/system/triggerhappy/test.conf.example
new file mode 100644
index 000000000000..458e6433b4fc
--- /dev/null
+++ b/system/triggerhappy/test.conf.example
@@ -0,0 +1,10 @@
+# 20201031 bkw: very simple test config.
+# cp test.conf.example test.conf
+# /etc/rc.d/rc.triggerhappy start
+# Press F11 and F12, while running:
+# watch ls /tmp/triggerhappy_works
+# Note that comments are allowed in triggerhappy's .conf files,
+# but blank lines ARE NOT allowed! That's why this looks so
+# cramped and hard to read...
+KEY_F11 1 /usr/bin/touch /tmp/triggerhappy_works
+KEY_F12 1 /usr/bin/rm /tmp/triggerhappy_works
diff --git a/system/triggerhappy/triggerhappy.SlackBuild b/system/triggerhappy/triggerhappy.SlackBuild
new file mode 100644
index 000000000000..8c8adb0f49dd
--- /dev/null
+++ b/system/triggerhappy/triggerhappy.SlackBuild
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+# Slackware build script for triggerhappy
+
+# Written by B. Watson (yalhcru@gmail.com)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+PRGNAM=triggerhappy
+VERSION=${VERSION:-0.5.0}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+SRCVER=release-$VERSION
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$SRCVER
+tar xvf $CWD/$PRGNAM-$SRCVER.tar.gz
+cd $PRGNAM-$SRCVER
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+make CFLAGS="$SLKCFLAGS"
+make install BINDIR=$PKG/usr/sbin MANDIR=$PKG/usr/man/man1
+strip $PKG/usr/sbin/*
+
+# man pages are installed +x, *gag*
+chmod -x $PKG/usr/man/man1/*.1
+gzip -9 $PKG/usr/man/man1/*.1
+
+# The example config won't actually get used unless renamed to end
+# in .conf (per the man page). Also include a much simpler test
+# config that can be used as-is.
+mkdir -p $PKG/etc/$PRGNAM/triggers.d
+cp -a *.conf.examples $PKG/etc/$PRGNAM/triggers.d
+cat $CWD/test.conf.example > $PKG/etc/$PRGNAM/triggers.d/test.conf.example
+
+# init script written by SlackBuild author. It's pretty rudimentary.
+mkdir -p $PKG/etc/rc.d
+cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM
+
+# Include our own README since it has manual config instructions.
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a AUTHORS COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README_SBo.txt
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/system/triggerhappy/triggerhappy.info b/system/triggerhappy/triggerhappy.info
new file mode 100644
index 000000000000..edaa5e53e625
--- /dev/null
+++ b/system/triggerhappy/triggerhappy.info
@@ -0,0 +1,10 @@
+PRGNAM="triggerhappy"
+VERSION="0.5.0"
+HOMEPAGE="https://github.com/wertarbyte/triggerhappy"
+DOWNLOAD="https://github.com/wertarbyte/triggerhappy/archive/release/0.5.0/triggerhappy-release-0.5.0.tar.gz"
+MD5SUM="2056cda4e9127cd375067f2cd3234616"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="yalhcru@gmail.com"