sxhkd is a simple X hotkey daemon, by the developer of bspwm, that reacts to input events by executing commands.


Install sxhkd or sxhkd-gitAUR.


sxhkd defaults to $XDG_CONFIG_HOME/sxhkd/sxhkdrc for its configuration file. An alternate configuration file can be specified with the -c option.

Each line of the configuration file is interpreted as so:

  • If it starts with #, it is ignored.
  • If it starts with one or more white space commands, it is read as a command.
  • Otherwise, it is parsed as a hotkey: each key name is separated by spaces and/or characters.

General syntax:


Where is one of the following names: , , , alt, , , , mode_switch, , , , , , mod5. If is added at the beginning of the keysym, the command will be run on key release events, otherwise on key press events. If is added at the beginning of the keysym, the command will be run on motion notify events and must contain two integer conversion specifications which will be replaced by the x and y coordinates of the pointer relative to the root window referential (the only valid button keysyms for this type of hotkeys are: , ..., ). The names are those your will get from xev.

Mouse hotkeys can be defined by using one of the following special keysym names: , , , ..., . The hotkey can contain a sequence of the form {STRING_1,…,}, in which case, the command must also contain a sequence with N elements: the pairing of the two sequences generates N hotkeys. If the command includes curly braces (, ) eg. , escape them with backslash eg. . In addition, the sequences can contain ranges of the form A-Z where A and Z are alphanumeric characters.

What is actually executed is , which means you can use environment variables in . will be the content of the first defined environment variable in the following list: SXHKD_SHELL, . If sxhkd receives a signal, it will reload its configuration file.


After configuring it, you may wish to setup sxhkd to autostart. An example systemd service file is found here. This approach requires configuring Xorg as a systemd user service.

Alternatively, if your desktop environment supports the Desktop Application Autostart Specification you can also have it start sxhkd by creating an file in the appropiate directory:


Then restart the user unit .

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.