Skip to content

yath/triggerhappy

 
 

Repository files navigation

Triggerhappy
- a lightweight hotkey daemon -

by Stefan Tomanek <stefan.tomanek+th@wertarbyte.de>
http://github.com/wertarbyte/triggerhappy/

Triggerhappy is a hotkey daemon developed with small and embedded systems in
mind, e.g. linux based routers. It attaches to the input device files and
interprets the event data received and executes scripts configured in its
configuration.

Examples:

Dump all events received through two device files:

	thd -d /dev/input/event0 /dev/input/event1

Read from /dev/input/event0 and launch scripts from /etc/triggerhappy/:

	thd -s /etc/triggerhappy/ /dev/input/event0

The daemon launches scripts that correspond to event name received; On pressing
the Enter key, thd launches /etc/triggerhappy/KEY_ENTER if present.

Event handlers can also be defined in a configuration file (specified by -e) of
the following format:

<event name>	<event value>	<command line>

e.g.

KEY_VOLUMEUP	1	/usr/bin/amixer set Master 20%+
KEY_VOLUMEUP	2	/usr/bin/amixer set Master 20%+
KEY_VOLUMEDOWN	1	/usr/bin/amixer set Master 20%-
KEY_VOLUMEDOWN	2	/usr/bin/amixer set Master 20%-

A value of 1 corresponds to pressing a key, while 2 is generated by
holding it; releasing it yields a value of 0.


Devices can be added dynamically by specifying a command pipe:

mkfifo /var/run/triggerhappy.pipe
thd -c /var/run/triggerhappy.pipe -e /etc/triggerhappy.conf

By writing "ADD" or "REMOVE" commands to the named pipe, devices
are added or removed without restarting the daemon:

echo "ADD /dev/input/event2" > /var/run/triggerhappy.pipe

About

A lightweight hotkey daemon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published