• Home
  • Blog
  • Linux
  • Keybindings to positioning windows in Lxde and Openbox

Keybindings to positioning windows in Lxde and Openbox

Working with development,  we use to deal with many open windows and type all the time, so it is very useful to have keyboard bindings allowing more than only maximize or minimize windows. I use Lubuntu, which is based on Openbox, and I am publishing here my lubuntu-rc.xml customizations, which depending on your system can be named as lxde-rc.xml or openbox-rc.xml.

Insert the code below right after the <keyboard> tag:

<!-- Custom keybindings **************************************
	 Actions reference: http://openbox.org/wiki/Help:Actions
	 
	 Super+A : decorate on/off
	 SUper+(1|2) : Move to monitor 1 or 2
	 Super+(Left|Right|Up|Down) : Dock
	 Super+(Insert,Home,Delete,End) : Quadrant
	 Super+0 : Center
	 Super+PageUp : Maximize
	 Super+PageDown: Minimize
	 
	 Super+Tab: List windows (as middle-click desktop)
 
 -->
<!-- Super+A = Toggle decoration -->
<keybind key="W-a">
	<action name="ToggleDecorations"/>
</keybind>
<!-- Super+1 = Move to monitor 1 -->
<keybind key="W-1">
	<action name="MoveResizeTo">
	<monitor>1</monitor>
	</action>
</keybind>
<!-- Super+1 = Move to monitor 2 -->
<keybind key="W-2">
	<action name="MoveResizeTo">
		<monitor>2</monitor>
	</action>
</keybind>
<!-- Super+Left = Dock undecorated left -->
<keybind key="W-Left">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>0</x>
		<y>0</y>
		<height>100%</height>
		<width>50%</width>
	</action>
</keybind>
<!-- Super+Right = Dock undecorated right -->  
<keybind key="W-Right">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>50%</x>
		<y>0</y>
		<height>100%</height>
		<width>50%</width>
	</action>
</keybind>
<!-- Super+Up = Dock undecorated up -->  
<keybind key="W-Up">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>0</x>
		<y>0</y>
		<height>50%</height>
		<width>100%</width>
	</action>
</keybind>
<!-- Super+Down = Dock undecorated down -->  
<keybind key="W-Down">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>0</x>
		<y>50%</y>
		<height>50%</height>
		<width>100%</width>
	</action>
</keybind>
<!-- Super+Insert = Dock undecorated Quadrant 1 -->
<keybind key="W-Insert">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>0</x>
		<y>0</y>
		<height>50%</height>
		<width>50%</width>
	</action>
</keybind>
<!-- Super+Home = Dock undecorated Quadrant 2 -->
<keybind key="W-Home">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>50%</x>
		<y>0</y>
		<height>50%</height>
		<width>50%</width>
	</action>
</keybind>
<!-- Super+Delete = Dock undecorated Quadrant 3 -->
<keybind key="W-Delete">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>0</x>
		<y>50%</y>
		<height>50%</height>
		<width>50%</width>
	</action>
</keybind>
<!-- Super+End = Dock undecorated Quadrant 4 -->
<keybind key="W-End">
	<action name="Unmaximize"/>
	<action name="Undecorate"/>
	<action name="MoveResizeTo">
		<x>50%</x>
		<y>50%</y>
		<height>50%</height>
		<width>50%</width>
	</action>
</keybind>
<!-- Super+0 = Restore to center, half-sized -->
<keybind key="W-0">
	<action name="Unmaximize"/>
	<action name="Decorate"/>
	<action name="MoveResizeTo">
		<x>center</x>
		<y>center</y>
		<height>50%</height>
		<width>50%</width>
	</action>
</keybind>
<!-- Super+PageUp = Maximize, decorated -->
<keybind key="W-Prior">
	<action name="Decorate"/>
	<action name="Maximize"/>
</keybind>
<!-- Super+PageDown = Minimize -->
<keybind key="W-Next">
	<action name="Decorate"/>
	<action name="Iconify"/>
</keybind>
<!-- Super+Tab = List Windows (same as middle-click desktop) -->
<keybind key="W-Tab">
  <action name="ShowMenu">
	<menu>client-list-combined-menu</menu>
  </action>
</keybind>
<!-- /Custom keybindings ************************************** -->

If you did not find any key called Super, don't worry. In Linux, this is the name given to the Windows key.

An important observation about the Super+A shortcut (decorate/undecorate): The topmost window's bars becomes useless once we have these shortcuts:

  1. Super+PgUp: Maximize
  2. Super+PgDown: Minimize
  3. Alt+F4: Close
  4. Alt+Space: context menu (default, and also is the same shortcut in Windows)
  5. Alt + Drag with left mouse button: Move window
  6. Alt + Drag with right mouse button: Resize window

Using this, you can save your arms, increase your productivity and get more space to work!