HK(1) General Commands Manual HK(1)

hkSet temporary X11 hotkeys

hk [-v -w] hotkey command [argument ...]

hk allows temporary X11 hotkeys to be set. For example:

hk Ctrl+Shift+F6 notify-send Hello

will execute the command “notify-send Hello” when “Ctrl+Shift+F6” is pressed. hk exits as soon as the command has executed.

The options are as follows:

Once the hotkey is released, prints at regular intervals to stdout which non-ignored keys (see the CAVEATS section) remain held. Only meaningful in conjunction with -w.
causes hk to wait until non-ignored (see the CAVEATS section) keys (not just the hotkey) are released before executing command.
hotkey
Is the hotkey to active the execution of command. Hotkeys take the form:
[Modifier1[+Modifier2[+...]]+]<Key>

The particular modifiers available depend on XKB's interpretation of your physical keyboard, but typically include / , , and so on. Modifiers are case insensitive. is case sensitive and again depends on XKB 's interpretation of your physical keyboard. If in doubt, xev(1) can be used to find out the XKB name of a physical key.

command [arguments ...]
is the program to be executed, using the outer shell's normal lookup mechanism to locate command. hk passes stdin, stdout, and stderr unchanged to command.

xev(1)

https://tratt.net/laurie/src/hk/

hk was written by Laurence Tratt ⟨https://tratt.net/laurie/⟩

hk ignores the Caps Lock, Mode Switch, Num Lock, and Scroll Lock modifiers when: determining if hotkey has been pressed; and determining whether any keys remain pressed for -w. However, other keyboard modifiers (which you may or may not be aware of!) can prevent hotkey being triggered.

December 12, 2021 OpenBSD 7.6