Linux: LXDE/Openbox, Change Keyboard Shortcuts
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
Example: 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.
Example: 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〕
Example: 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>
Example: 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>
Example: 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
S
→ Shift keyC
→ Ctrl keyA
→ Alt keyW
→ Super key (the Microsoft Windows logo key)M
→ Meta keyH
→ Hyper key
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 removeCtrl+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