Many desktop environments and window managers support window snapping (e.g. Windows 7 Aero snap), whereby they will automatically snap into place when moved to the edge of the screen. This effect can also be simulated in Openbox through the use of keybinds on focused windows.
As illustrated in the example below, percentages must be used to
determine window sizes (see openbox.org for
further information). In this instance, The super
key
is used in conjunction with the navigation
keys:
<keybind key="W-Left">
<action name="Unmaximize"/>
<action name="MaximizeVert"/>
<action name="MoveResizeTo">
<width>50%</width>
</action>
<action name="MoveToEdge"><direction>west</direction></action>
</keybind>
<keybind key="W-Right">
<action name="Unmaximize"/>
<action name="MaximizeVert"/>
<action name="MoveResizeTo">
<width>50%</width>
</action>
<action name="MoveToEdge"><direction>east</direction></action>
</keybind>
However, it should be noted that once a window has been 'snapped' to an
edge, it will remain vertically
maximised unless subsequently maximised and then restored. The solution is to
implement additional keybinds - in this instance using the down
and up
keys - to do so. This will also make pulling
'snapped' windows from screen edges faster as well:
<keybind key="W-Down">
<action name="Unmaximize"/>
</keybind>
<keybind key="W-Up">
<action name="Maximize"/>
</keybind>
This Ubuntu
forum thread provides more
information.
Applications such as opensnapAUR are also available to
automatically simulate window snapping behaviour without the use of keybinds. Another option is to
use bunsen-utilities-gitAUR which provides bl
-
aerosnap
--
left
and bl
-
aerosnap
--
right
commands
which will snap active window on left or right edge respectively if it is not
snapped and restore it to original size and position otherwise. Just bind these commands to
the key combination of your choosing.