How To Have Snapping Windows in Lubuntu | Tgames19

How To Have Snapping Windows in Lubuntu

June 25, 2023

if you came to Linux from Windows, you may be used to how windows can snap to the sides and corners of the screen for easy multitasking. This feature does not come out of the box in Lubuntu 20.04+. However, it is possible to get Openbox, Lubuntu's Window Manager to let us snap windows. This is how.



This process is very simple. The only thing you have to do is paste some code into a file. This file is ~/.config/openbox/rc.xml or, the expanded version, /home/YOURUSERNAME/.config/openbox/rc.xml Open this file in your favorite text editor, and find the </keyboard> tag. Right before that tag, paste this:

<!-- Window snapping code we are adding -->
<keybind key="A-Left">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
<height>100%</height>
<x>0%</x>
<y>0%</y>
</action>
</keybind>
<keybind key="A-Right">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>50%</width>
<height>100%</height>
<x>50%</x>
<y>0%</y>
</action>
</keybind>
<keybind key="A-Down">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>100%</width>
<height>50%</height>
<x>0%</x>
<y>50%</y>
</action> </keybind> <keybind key="A-Up">
<action name="UnmaximizeFull"/>
<action name="MoveResizeTo">
<width>100%</width>
<height>50%</height>
<x>0%</x>
<y>0%</y>
</action>
</keybind>
The keyboard shortcuts to snap windows in this article are Alt+Arrow Key. If you wish to change this, you can change the A to C for control+Arrow Keys instead. Ex: <keybind key="C-Down">

To apply the changes, simply open a shell and run openbox --reconfigure!
With that, you have snapping windows!