10

Is there any way I can tile two windows horizontally (⬒) or vertically (◧ ) under Lubuntu/LXDE/Openbox? Maybe via a keyboard shortcut or panel button?

16

Configuration:

Yes, you can achieve this by adding a few custom keyboard shortcuts to your openbox configuration file.

Open your rc.xml variant (e.g. ~/.config/openbox/lxde-rc.xml, ../lubuntu-rc.xml or ../rc.xml) and insert the following snippet within the <keyboard>..</keyboard> section:

<!-- Vertical tiling -->
<keybind key="C-W-v">
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <width>50%</width>
  </action>
  <action name="MaximizeVert"/>
  <action name="MoveResizeTo">
    <x>0</x>
    <y>0</y>
  </action>
  <action name="NextWindow">
    <interactive>no</interactive>
    <dialog>none</dialog>
    <finalactions>
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo">
        <width>50%</width>
      </action>
      <action name="MaximizeVert"/>
      <action name="MoveResizeTo">
        <x>-0</x>
        <y>0</y>
      </action>
    </finalactions>
  </action>
</keybind>

<!-- Horizontal tiling -->
<keybind key="C-W-h">
  <action name="UnmaximizeFull"/>
  <action name="MoveResizeTo">
    <height>50%</height>
  </action>
  <action name="MaximizeHorz"/>
  <action name="MoveResizeTo">
    <x>0</x>
    <y>0</y>
  </action>
  <action name="NextWindow">
    <interactive>no</interactive>
    <dialog>none</dialog>
    <finalactions>
      <action name="UnmaximizeFull"/>
      <action name="MoveResizeTo">
        <height>50%</height>
      </action>
      <action name="MaximizeHorz"/>
      <action name="MoveResizeTo">
        <x>0</x>
        <y>-0</y>
      </action>
    </finalactions>
  </action>
</keybind>

<!-- Restore window dimensions -->
<keybind key="C-W-r">
  <action name="UnmaximizeFull"/>
  <action name="NextWindow">
    <interactive>no</interactive>
    <dialog>none</dialog>
    <finalactions>
      <action name="UnmaximizeFull"/>
    </finalactions>
  </action> 
</keybind>

Shortcuts in action:

enter image description here

Usage:

  • Super+Ctrl+V: Tile last active windows vertically
  • Super+Ctrl+H: Tile last active windows horizontally
  • Super+Ctrl+R: Restore original window dimensions

To modify these assignments simply edit the <keybind key="..."> lines in the snippet above.

Notes:

  • This method will only tile the two last active windows
  • You can swap window positions by focussing the inactive window and pressing the hotkey again
  • 1
    Me likey the animated gif... just wish you could have worked in blink and marquee tags as well!! :) -But really, good use of the gif. – Scott Goodgame Aug 27 '14 at 10:17
  • 2
    Do not forget to execute command openbox --reconfigure to use your changed settings. – Evmorov Mar 28 '15 at 19:19
  • To bind NumPad keys use KP_1 ... KP_9 keys: <keybind key="C-A-KP_1"> = Ctr+Alt+NumPad1 or <keybind key="W-KP_1"> = SuperKey+NumPad1. See openbox documentation. – Y.B. May 15 '17 at 20:17
  • Dam that's a beautiful answer. – theYnot May 21 '18 at 7:49

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.