Thursday, January 2, 2014

Keybindings in Openbox

When I log into XFCE on my work desktop remotely using NoMachine's NX client, the "p" button stopped working.  Instead of messing with my XFCE settings, I tried logging into LXDE.  The "p" button worked.

Then I needed to remap the keyboard shortcuts for switching/cycling through windows.  I'm using a Mac Pro at home, and left Command-Tab alone.  Instead, I wanted my keyboard's control + tab keys to cycle through windows.  In XFCE, I would have gone to the window manager settings in the main settings dialog.  However, it looks like I had to manually edit Openbox's keyboard mappings in an XML file.

I ran xev in the X session to find out which key was being pressed.  It said Control_L and Tab were being pressed.  When I edited the /.config/openbox/lxde-rc.xml file from:

   1:  <!-- Keybindings for window switching -->
   2:  <keybind key="A-Tab">
   3:    <action name="NextWindow"/>
   4:  </keybind>
...to:
   1:  <!-- Keybindings for window switching -->
   2:  <keybind key="Control_L-Tab">
   3:    <action name="NextWindow"/>
   4:  </keybind>
...it didn't work.  I didn't care if it was the left or right Control key, so I just changed it to:
   1:  <!-- Keybindings for window switching -->
   2:  <keybind key="C-Tab">
   3:    <action name="NextWindow"/>
   4:  </keybind>
Then I typed openbox --reconfigure to reload the settings without restarting Openbox, and it worked as expected.

References:


http://openbox.org/wiki/Help:Bindings
http://superuser.com/questions/248517/show-keys-pressed-in-linux
http://linux.die.net/man/1/xev