Linux: LXDE/Openbox, Change Keyboard Shortcuts

By Xah Lee. Date: . Last updated: .

This page shows you how to add or remove keyboard shortcuts for linux LXDE/Openbox.

Edit the file at

~/.config/openbox/lxde-rc.xml

or

~/.config/openbox/lubuntu-rc.xml

Toggle Maximize Window

For example, to make F12 key toggle maximize window, add the following

<!-- toggle maximize window -->
<keybind key="F12">
  <action name="ToggleMaximize"/>
</keybind>

Copy and paste the above inside the <keyboard>…</keyboard> tags.

Run Terminal Command

This example shows how to set a key to run any terminal command.

<!-- switch to Firefox -->
<keybind key="F8">
  <action name="Execute">
    <command>wmctrl -xa firefox</command>
  </action>
</keybind>

You need to install wmctrl for switching windows by name.

[see Linux: Add Keyboard Shortcut to Switch App]

Resize/Move Window

Examples of resize window, move window, etc.

<!-- resize window. Control F1 -->
<keybind key="C-F1">
  <action name="Resize"/>
</keybind>

<!-- move window -->
<keybind key="C-F2">
  <action name="Move"/>
</keybind>

<keybind key="F1">
  <action name="Iconify"/>
</keybind>

<keybind key="F12">
  <action name="ToggleMaximize"/>
</keybind>

Switch to Next Window

This example switch to next window, like 【Alt+Tab】, but using the Pause key.

<!-- like alt+tab, use pause key -->
<keybind key="Pause">
  <action name="NextWindow">
    <dialog>yes</dialog>
    <interactive>yes</interactive>
    <raise>yes</raise>
  </action>
</keybind>

Send a Key

The next example shows you how to send a key. You need xvkbd installed.

[see Linux: xvkbd tutorial]

<!-- prev tab -->
<keybind key="F11">
  <action name="Execute">
    <command>xvkbd -no-jump-pointer -xsendevent -text '\C\[ISO_Left_Tab]'</command>
  </action>
</keybind>

<!-- next tab -->
<keybind key="F12">
  <action name="Execute">
    <command>xvkbd -no-jump-pointer -xsendevent -text '\C\[Tab]'</command>
  </action>
</keybind>

<!-- close window. Ctrl+w -->
<keybind key="F14">
  <action name="Execute">
    <command>xvkbd -no-jump-pointer -xsendevent -text '\Cw'</command>
  </action>
</keybind>

Reload Config File

After you changed the config, reload it, by

# reload openbox key config
openbox-lxde --reconfigure

Key Syntax

Modifier key syntax

For example, if you want 【Alt+7】, use <keybind key="A-7">.

Special Key Syntax

Key syntax for function keys. page up/down, home/end, tab, enter, etc, are standard X11 “keysyms”.

[see Linux: X11 Keyboard Key Names]

For example, if you want 【Alt+】, use <keybind key="A-Up">.

Remove Keys

To remove keys, just delete the proper section.

For example, i want to remove【Ctrl+Alt+】 (because i need it for emacs). I delete the following:

<keybind key="C-A-Left">
  <action name="DesktopLeft">
    <dialog>no</dialog>
    <wrap>no</wrap>
  </action>
</keybind>

<keybind key="C-A-Right">
  <action name="DesktopRight">
    <dialog>no</dialog>
    <wrap>no</wrap>
  </action>
</keybind>

<keybind key="C-A-Up">
  <action name="DesktopUp">
    <dialog>no</dialog>
    <wrap>no</wrap>
  </action>
</keybind>

<keybind key="C-A-Down">
  <action name="DesktopDown">
    <dialog>no</dialog>
    <wrap>no</wrap>
  </action>
</keybind>

Disable Mouse Scroll Wheel Shade Window

Linux: LXDE/OpenBox, Disable Mouse Scroll Wheel Hide Window

Reference

http://openbox.org/wiki/Help:Bindings

Linux Desktop

  1. Most Useful GUI Apps
  2. Set Default App
  3. Shell Commands for GUI Apps
  4. Image Viewers
  5. Music Players
  6. Move File to Trash by Command
  7. X11 Selection and Clipboard
  8. How to Switch to LXDE, Xfce
  9. LXDE Keyboard Shortcuts
  10. LXDE/Openbox, Change Keyboard Shortcuts
  11. LXDE Set Key Repeat Rate
  12. LXDE/OpenBox, Disable Mouse Scroll Wheel Hide Window
  13. Xfce Keyboard Shortcuts
  14. Xfce Good Themes
  15. xmonad Keybinding
  16. How to Restart X11
  17. Why Tiling Window Manager Sucks

If you have a question, put $5 at patreon and message me.