sxhkd: super + key binding not working

Hardware: Lenovo Thinkpad laptop

When editing sxhkdrc like:

Super_L + f
    firefox

makes f key to bind to firefox command, and the actual Super_L + f prints the “f” letter in the terminal. I’m setting the key names according to what xev prints when I press the desired keys. The same error goes using super instead of Super_L If I try to add a different key combo like Super_L + Return it happens the same; Return binds to whatever command I associate in the next line, and Super_L + Return executes return normally.

What can be causing this?

sxhkd version is 0.6.1

About this issue

Most upvoted comments

On starting/reloading sxhkd: for those doing any keyboard layout changes I found it important that these are done before sxhkd is started.

On reloading sxhkd I found that sending sxhkd the -USR1 signal to reload wasn’t sufficient if keyboard layout changes have been made since sxhkd was first launched (say, with setxkbmap or xmodmap) and where sxhkd is maintaining the same PID since before the layout change. However, killing the process entirely and relaunching seems to fix it for me. That is, it has been sufficient for me to do pkill -x sxhkd && sxhkd & rather than pkill -USR1 -x sxhkd after making any keyboard layout changes. I’ve actually modified my config

super + Escape
	pkill -USR1 -x sxhkd
super + shift + Escape
	pkill -x sxhkd && sxhkd

@0xPr0x an aside: xkb also has the option -option altwin:swap_lalt_lwin or -option altwin:swap_alt_win so you can remove the dependency on xmodmap from your config 😃. For a full list see if you have /usr/share/X11/xkb/rules/base.lst.

Super_L + f
    firefox

Super_L + f is not a valid chord: it’s formed by two keysyms!

The manual defines the config syntax like so:

General syntax:

    HOTKEY
        [;]COMMAND

    HOTKEY      := CHORD_1 ; CHORD_2 ; ... ; CHORD_n
    CHORD_i     := [MODIFIERS_i +] [~][@]KEYSYM_i
    MODIFIERS_i := MODIFIER_i1 + MODIFIER_i2 + ... + MODIFIER_ik

The valid modifier names are: super, hyper, meta, alt, control, ctrl,
shift, mode_switch, lock, mod1, mod2, mod3, mod4, mod5 and any.

The keysym names are given by the output of xev -event keyboard.

[...]

Notice that you can’t have a chord with two keysyms: you can only have chords with exactly one keysym and with any number of modifiers.

Some examples:

  • Super_L and f are both keysyms → ❎ Super_L + f is an invalid hotkey (0m+2k);
  • super is a modifier and f is a keysym → ☑️ super + f is a valid hotkey (1m+1k);
  • super is a modifier → ❎ super is an invalid hotkey (1m+0k);
  • Super_L is a keysym → ☑️ Super_L is a valid hotkey (0m+1k).

You are misusing sxhkd trying to bind something to Super_L + f, so you should expect…

Super_L + f
	firefox

…to not work!

Interesting I have this issue and I am starting sxhkd from bspwmrc here is my configuration for reference:

https://gist.github.com/amacgregor/9d0b556103db9f5c5a2f1def6ba874ac

I’m having the same issue, keybinds work after restart but when I hot reload they stop working even after killing and running sxhkd again manually. I swapped my ALT and SUPER keys because I am running bspwm in a VM on a Windows host. I noticed you did the same and I believe that is the problem. As a test I disabled the config that remaps Super Alt and sxhkd works as expected.