Wednesday, October 1, 2014

linux - How to set a single modifier key as a shortcut in openbox?


I want to have my super key start dmenu.
I set it as a keyboard shortcut in my rc.xml:




dmenu_run



I tried specifying it as W, W-, and in with its key code (0x85). W responds to pressing the letter w, W- does nothing, and 0x85 triggers dmenu immediately on the KeyPress event instead of waiting for KeyRelease. So other key combos that use super as a modifier will trigger dmenu instead.


How can tell openbox that I only want the shortcut to trigger when the super key is pressed and released on it's own without any other keypresses?


Answer



I got it to work by using xcape (packaged in the AUR).


From it's man page:



xcape allows a modifier key to be used as another key when it is pressed and released on its own.



In short, I assigned super to a dummy shortcut (⎈ Ctrl⇧ Shift⎇ AltLinux key SuperD) with


xcape -e 'Super_L=Control_L|Shift_L|Alt_L|Super_L|D'

Note that you'll have to run this each time you reboot, so you may want to put it in your ~/.config/openbox/autostart script or something.


This dummy shortcut is picked up by openbox with an entry in rc.xml:




dmenu_run





I also wrote a slightly more detailed answer about this here.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...