-
Notifications
You must be signed in to change notification settings - Fork 1
Determining hotkey strings
The process of determining the appropriate string to put in a hotkey
line in your config can be a bit non-obvious -- on X11, xev
and xmodmap
can help.
First, pick which physical keys on your keyboard you want to act as your hotkey combination (one non-modifier key and zero or more modifier keys). Start xev
and press each of these keys individually, noting what keysym each one comes out as (things like, say, Super_L
or h
or F3
). Your non-modifier key will appear in the hotkey string exactly as it does in xev
's output. For the modifier keys, you'll need to trace them through your xmodmap to determine what "logical" modifier they map to. To do this, run xmodmap
, and for each modifier keysym you found through xev
, find the logical modifier (things like control
or shift
or mod2
) in the first column of the line containing the desired keysym. Then just concatenate all the resulting strings together with +
as a separator to produce the string to put in your hotkey
config line.
Full example: I run xev
and see that for my hotkey combination I want the keysym Left
with the modifier keysyms Control_L
and Alt_L
. I then run xmodmap
, which shows the following:
[me@host: ~]% xmodmap
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock
control Control_L (0x25), Control_L (0x42), Control_R (0x69)
mod1 Alt_L (0x85), Alt_R (0x86), Alt_L (0xce)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x40), Super_R (0x6c), Super_L (0xcc)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
From that, we see that Control_L
maps to control
and Alt_L
maps to mod1
. The resulting config line might then look like hotkey["control+mod1+Left"] = switch left
.
Note that while the modifier names are matched case-insensitively (mod1
and Mod1
are equivalent), Xlib matches the keysym name for the non-modifier key case-sensitively, so be sure to use e.g. Left
and not left
.
If you don't have xev
or xmodmap
installed, the name of the relevant package may vary depending on your system. For the three I have on hand at the moment, these are:
| RHEL6 | Debian Jessie | FreeBSD 10
--------:|:------------------------:|:-----------------:|:-----------:
xev
| xorg-x11-utils
| x11-utils
| xev
xmodmap
| xorg-x11-server-utils
| x11-server-utils
| xmodmap