Skip to content

Latest commit

 

History

History
105 lines (58 loc) · 3.75 KB

thd.pod

File metadata and controls

105 lines (58 loc) · 3.75 KB

NAME

thd -- triggerhappy global hotkey daemon

SYNOPSIS

thd [--help] [--dump] [--socket socket] [--trigger config] [--daemon] [--pidfile file] [--ignore event] [devices...]

DESCRIPTION

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 a graphical user interface.

OPTIONS AND ARGUMENTS

--help

Shows usage instructions

--triggers conf

Read trigger definitions from file

--dump

Dump all recognized events to STDOUT

--socket file

Open a unix domain socket at file; this socket can be used to send commands to the running daemon (by using the program th-cmd), e.g. for adding or removing devices.

--daemon

Run as a background daemon and detach from the terminal.

--pidfile file

Write PID to file.

--ignore eventname

Ignore key and switch event labeled eventname. This can be used to suppress the FN key on some notebooks which only generates events sometimes and might screw up key combinations.

Additional command line arguments are considered filenames of input devices.

CONFIGURATION

Configuring event handlers

The hotkey bindings used by Triggerhappy are set in the configuration file specified by --triggers. Each line consists of three segments: The symbolic name of the key or event name to react on, the value carried by the expected event, and of course the command to be launched.

The event names can be identified by operating the desired key or switch while running the triggerhappy daemon with the option --dump.

Key events carry the value 1 for a key being pressed and transmit the payload 0 when it is released; holding the key down constantly yields events with a value of 2.

The command can include any number of arguments. Please include the full path to avoid trouble through different $PATH settings for the daemon and your interactive session.

The three fields are seperated by an arbitrary number of whitespaces, while anything behind a # character is ignored and considered a comment.

EXAMPLE

Starting the daemon

thd --dump /dev/input/event*

Dump all events processable by thd to the console; this is useful to find out the correct event name for a specific key.

thd --triggers /etc/triggerhappy/triggers.conf /dev/input/event*

Read from all currently connected input devices and process events according to the file /etc/triggerhappy/triggers.conf.

thd --triggers /etc/triggerhappy/triggers.conf --socket /var/run/thd.socket

Do not open any input devices yet, but bind the socket /var/run/thd.socket for th-cmd to connect to.

Configuration files

Any number of event handlers can be placed in the configuration file:

# /etc/triggerhappy/triggers.conf
#
# Suspend the system
KEY_SLEEP                   1       /usr/sbin/hibernate-ram
KEY_SLEEP+KEY_LEFTSHIFT     1       /usr/sbin/hibernate-disk

# Change mixer volume when pressing the appropiate keys (or holding them)
KEY_VOLUMEUP    1      /usr/bin/amixer set Master 5%+
KEY_VOLUMEUP    2      /usr/bin/amixer set Master 5%+
KEY_VOLUMEDOWN  1      /usr/bin/amixer set Master 5%-
KEY_VOLUMEDOWN  2      /usr/bin/amixer set Master 5%-

AUTHOR

Stefan Tomanek <[email protected]>