I'm trying to use xbindkeys with an event that is produced with mode_switch + <key>, but xbindkeys is triggered with only the <key> instead of the combination of it with the mode_switch.

I'm using xmodmap to map the mode_switch to right alt:

keycode 108 = Mode_switch Mode_switch Mode_switch Mode_switch

When xbindkeys process is not running, I can see the expected events with xev, for the <key> alone and for the combination of mode_switch + <key>.

But when xbindkeys is running, it is triggering the code attached to it on the <key> alone, instead of the combination, which overrides what the key does originally.

For example, if I bind Pointer_Button5 to the letter n with:

keysym n = n N Pointer_Button5

without xbindkeys I can see n alone and Pointer_Button5 when using mode_switch + n in xev, but with xbindkeys running, I can no longer use the n key, it instead is triggering the script attached to it.

It seems to be the same for other keys and events as well, not only Pointer_Button5 or the letter n.


You will probably need to update the used keyboard mapping (language/keyboard-model) to add the "alt" key that you are emulating... xmodmap wont be required after that.

This can be done by editing the keyboard (language) file under /usr/share/X11/xkb/symbols/inet or /usr/share/X11/xkb/symbols/fr if you are using french keybpard (location may differ)

Make sure the proper key is working then restart xbindkeys.

(Not sure 100% but this may help, also this solution will be erased with package updates, so backup your changes)

  • 1
    I'm mapping Alt_R to produce Mode_switch which is then used as a layout switch for combination with other keys. I was hoping of solving it with xmodmap since it seems much simpler, but I'll give it a try. Maybe similar to this issue, some programs e.g. unity-editor and freemind treat this bind of Mode_switch +hjkl arrows differently than real arrows. In xev the difference is the state, for Mode_switch + hjkl (or any other keys) it is 0x2000` and for arrows it is 0x0. – Radivarig Jan 7 '20 at 21:59
  • I guess that you have some trouble because the mapped key is emulated, i know that editing the keyboard mapping as i suggested is done at a lower level and thus may help... had a similar issue and ended-up doing that to fully remap the key – intika Jan 7 '20 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.