mirror of
git://projects.qi-hardware.com/openwrt-packages.git
synced 2025-04-21 12:27:27 +03:00
add triggerhappy hotkey daemon
Triggerhappy is a lightweight hotkey daemon that can launch arbitrary commands on input events. It supports the hotplugging of devices and the processing of key combinations. Signed-off-by: Stefan Tomanek <stefan.tomanek+openwrt@wertarbyte.de>
This commit is contained in:
committed by
Xiangfu Liu
parent
dca49397c2
commit
4dcfd38b2f
14
utils/triggerhappy/files/triggerhappy-example.conf
Normal file
14
utils/triggerhappy/files/triggerhappy-example.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
# This is an example configuration for the triggerhappy daemon (thd)
|
||||
# please note that every file to be processed must end in ".conf"
|
||||
#
|
||||
# To view a list of supported event codes, use "thd --listevents" or
|
||||
# "thd --dump /dev/input/event*"
|
||||
#
|
||||
# Format:
|
||||
# <eventcode> <value> <command>
|
||||
#
|
||||
# values for key events are 1 (pressed), 0 (released) or 2 (held)
|
||||
#
|
||||
## control an mpd instance
|
||||
# KEY_NEXTSONG 1 /usr/bin/mpc next
|
||||
# KEY_PREVSONG 1 /usr/bin/mpc prev
|
||||
15
utils/triggerhappy/files/triggerhappy.hotplug
Normal file
15
utils/triggerhappy/files/triggerhappy.hotplug
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
THD_SOCKET=/tmp/triggerhappy.socket
|
||||
[ -S "$THD_SOCKET" ] || exit
|
||||
|
||||
case "$ACTION" in
|
||||
add)
|
||||
DEVICE="/dev/$DEVNAME"
|
||||
[ -c "$DEVICE" ] || exit
|
||||
# offer device to triggerhappy daemon
|
||||
/usr/sbin/th-cmd --socket "$THD_SOCKET" --add "$DEVICE"
|
||||
;;
|
||||
remove)
|
||||
# nothing to do
|
||||
;;
|
||||
esac
|
||||
10
utils/triggerhappy/files/triggerhappy.init
Normal file
10
utils/triggerhappy/files/triggerhappy.init
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=93
|
||||
|
||||
start() {
|
||||
/usr/sbin/thd --socket /tmp/triggerhappy.socket --triggers /etc/triggerhappy/triggers.d/ --daemon /dev/input/event*
|
||||
}
|
||||
|
||||
stop() {
|
||||
/usr/sbin/th-cmd --socket /tmp/triggerhappy.socket --quit
|
||||
}
|
||||
Reference in New Issue
Block a user