Ubuntu – How to make keyboard shortcuts register on key release, rather than on key press


I want to have shortcuts like in Windows; Super opens the start menu, Super+S opens a search window, Super+E opens Thunar, etc.

I know how to set keyboard shortcuts, but when I set Super to open whiskermenu, whiskermenu also pops up in every other instance of Super+* shortcuts. I think this is because XFCE registers the shortcuts as they come, rather than waiting for simultaneous release (like in Windows).

How do I set that up?

Best Answer

You can achieve it this way:**

  1. Install xbindkeys

    sudo apt install xbindkeys
  2. Run the command:

    xbindkeys --key

    In the white box that appears, Press your key combination. Example Win + E will return the following :

    "(Scheme function)"
        m:0x50 + c:26
        Mod2+Mod4 + e

    Now copy the last (or last second) line and use it as given below.

    In newer versions before you need to do this, which let you jump the next step:

    Please, create one with 'xbindkeys --defaults > /home/$USER/.xbindkeysrc'.
    or, if you want scheme configuration style,
    with 'xbindkeys --defaults-guile > /home/$USER/.xbindkeysrc.scm'

  3. Create a new file .xbindkeysrc in your home Directory

    touch $HOME/.xbindkeysrc

    Open it

    nano $HOME/.xbindkeysrc

    Enter your required command and keys as given below

        release+Mod2+Mod4 + e

    (Note: Don't forget release , Replace "nautilus" with any command.)

    Similarly add all the requires command-key combinations one below the other

  4. Now add xbindkeys to xinitrc:

    sudo nano /etc/X11/xinit/xinitrc

    add xbindkeys to the starting (1st line or before . /etc/X11/Xsession)

Reboot your system and you should get expected behavior

TIP: Make sure you don't set conflicting configurations in xbindkeys and your GUI method provided by your DE

For more examples, man xbindkeys.