10 must-have key and mouse binding configs in Openbox

In openbox, you have a configuration file in ~/.config/openbox/rc.xml in which you can pretty much configure all the shortcuts you need in a lifetime. Here's my top ten configurations, along with their code.

Note that all keyboard and mouse configurations go in the <keyboard>...</keyboard> and <mouse>...</mouse> sections of the configuration file respectively. The "Super" key mentioned several times is usually the Windows-logo key most people have, but could be an Apple command-key too, or maybe some other variant I don't know about.

10. MS-Windows style DoubleClick on the titlebar application icon

Same behaviour as in Microsoft Windows, something I have gotten used to in the Windows years, double clicking the icon on the titlebar to close a window. Awesomely no problem at all in openbox:

<context name="Icon">
  <mousebind action="DoubleClick" button="Left">
    <action name="Focus"/>
    <action name="Close"/>
  <!-- ... -->

9. MS-Windows style keyboard shortcuts

Why get rid of habits I picked up rather than exploiting them? These five never left my system, neither physically nor mentally.

<keybind key="W-d"><action name="ToggleShowDesktop"/></keybind>
<keybind key="W-l"><action name="Execute"><command>xscreensaver-command -lock</command></action></keybind>
<keybind key="W-r"><action name="Execute"><command>gmrun</command></action></keybind>
<keybind key="W-e">
  <action name="Execute">
<keybind key="A-Tab">  <action name="NextWindow"><raise>yes</raise></action></keybind>
<keybind key="A-S-Tab"><action name="PreviousWindow"><raise>yes</raise></action></keybind>

8. Workspace movement and selection

I only use the "next" and "previous" workspace features. So in fact, the only 6 involved shortcuts are either moving to the next or previous workspace, or moving to the previous or next workspace dragging the active window along, or Alt-Tabbing through the windows on all desktops.

<keybind key="W-Right">   <action name="DesktopRight"><wrap>no</wrap></action></keybind>
<keybind key="W-Left">    <action name="DesktopLeft"><wrap>no</wrap></action></keybind>
<keybind key="S-W-Left">  <action name="SendToDesktopLeft"><wrap>no</wrap></action></keybind>
<keybind key="S-W-Right"> <action name="SendToDesktopRight"><wrap>no</wrap></action></keybind>
<keybind key="W-Tab">     <action name="NextWindow"><allDesktops>yes</allDesktops></action></keybind>
<keybind key="W-S-Tab">   <action name="PreviousWindow"><allDesktops>yes</allDesktops></action></keybind>

7. Move window to another monitor

Some left-over habits of working with UltraMon on a dual-monitor setup on Windows:

<keybind key="C-S-A-Left">  <action name="MoveResizeTo"><monitor>2</monitor></action></keybind>
<keybind key="C-S-A-Right"> <action name="MoveResizeTo"><monitor>1</monitor></action></keybind>

6. Combining with PyTyle: Tiling within a floating layout

This is actually not part of the openbox configuration (except that pytyle is in my

I have PyTyle to do my tiling. I like to use tiling to have a quick overview of some windows I will be using for the next hour or so. Usually that is an editor, a terminal and maybe a browser. Activating the tiled layout using Super+~ and deactivating it with Super-Shift-~ is very useful. Furthermore I use Super+[ and Super+] to cycle through the windows, Super+\ to make the active window master, Super+= to increase master size and Super+- to decrease master size, Super+Shift+- to remove a master and Super+Shift+= to add a master. Lastly, Super+Backspace is used to cycle through tiled layouts.-+


Config.KEYMAP = {
    'Super-asciitilde': 'tile.default',
    'Super-Shift-asciitilde': 'untile',

    'Super-BackSpace': 'cycle_tiler',
    'Super-Alt-asciitilde': 'reload',

    'Super-plus': 'master_increase',
    'Super-minus': 'master_decrease',

    'Super-Shift-plus': 'add_master',
    'Super-Shift-minus': 'remove_master',

    'Super-backslash': 'make_active_master',
    'Super-Shift-backslash': 'win_master',

    'Super-bracketleft': 'win_previous',
    'Super-bracketright': 'win_next',

    'Super-Shift-bracketleft': 'switch_previous',
    'Super-Shift-bracketright': 'switch_next',

5. Application shortcuts

The five applications I use most frequently got their own shortcut. A terminal (currently urxvt), two browsers (Chromium for regular browsing, Firefox for development), gedit for editing and Thunderbird for mail. These are the accompanying shortcuts:

<keybind key="W-b">   <action name="Execute"><command>chromium</command></action></keybind>
<keybind key="W-A-b"><action name="Execute"><command>firefox</command></action></keybind>
<keybind key="W-n">   <action name="Execute"><command>gedit</command></action></keybind>
<keybind key="W-m">   <action name="Execute"><command>thunderbird</command></action></keybind>
<keybind key="W-t">   <action name="Execute"><command>urxvt</command></action></keybind>

4. Mouse-moving and resizing with a modifier key

I have enabled Super+Left on my mouse for quick moving of windows. This means you don't have to select the title bar to move the window around, you just click anywhere on the window while having the Super-key pressed, and drag it along. With Alt also pressed, resizing is done of windows. This means that whatever edge your mouse cursor is closest too, that direction the resize will occur, so no more sharp-shooting to get the cursor exactly at the edge or corner of a window to get it resized, just use the modifier key(s) to resize. Super+DoubleClick will maximize the window. Finally, Super+Right will open the openbox client menu.

<context name="Frame">
  <mousebind action="Press" button="W-Left">
    <action name="Focus"/>
    <action name="Raise"/>
  <mousebind action="Drag" button="W-Left">
    <action name="Move"/>
  <mousebind action="DoubleClick" button="W-Left">
    <action name="Focus" />
    <action name="Raise" />
    <action name="ToggleMaximizeFull" />
  <mousebind action="Drag" button="W-A-Left">
    <action name="Resize"/>
  <mousebind action="Press" button="W-A-Left">
    <action name="Lower"/>
    <action name="FocusToBottom"/>
    <action name="Unfocus"/>
  <mousebind action="Press" button="W-Right">
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="ShowMenu">
  <!-- ... -->

3. Fixed width resize

I like to be able to have my windows resized at a fixed width, e.g. browsers, file managers, mail applications, usually do the best job at about 960 pixels or about 1200 pixels wide. So, having Super+Keypad / as a shortcut for the former and Super+Alt+Keypad / for the latter, I easily put the window in a comfortable position combining with the number 1 and 2 of this post.

<keybind key="W-KP_Divide"> <action name="MoveResizeTo"><width>960</width></action></keybind>
<keybind key="W-A-KP_Divide"> <action name="MoveResizeTo"><width>1200</width></action></keybind>

2. Maximize and Maximize Vertical

I even use Maximize vertical more often than maximize, since vertical maximization is usually actually what you want. The width of the screen mostly is either fine as it is, or can be simply adjusted using the fixed width shortcut mentioned previously.

<keybind key="W-Return">   <action name="ToggleMaximizeFull"/></keybind>
<keybind key="W-A-Return"> <action name="ToggleMaximizeVert"/></keybind>

1. Move windows to screen corners and edges

Use your numpad to move the active window to screen edges, having all keypad numbers moving the window to the edge the key points at

<keybind key="W-KP_8"><action name="MoveResizeTo"><y>0</y></action></keybind>
<keybind key="W-KP_6"><action name="MoveResizeTo"><x>-0</x></action></keybind>
<keybind key="W-KP_2"><action name="MoveResizeTo"><y>-0</y></action></keybind>
<keybind key="W-KP_4"><action name="MoveResizeTo"><x>0</x></action></keybind>

That's it! If you have any shortcuts or configurations you'd like to share, go right ahead :)

< Return to main page

You're looking at a very minimalistic archived version of this website. I wish to preserve to content, but I no longer wish to maintain Wordpress, nor handle the abuse that comes with that.