Ubuntu: How can window snap be enabled in Openbox?



Question:

I would like to have window snap behaviour in Openbox. For me, this would mean that dragging a window to the edge of the display using the mouse would change the size of the window such that it is docked in half or quarter of the display, as can be done in Unity7. How can this be done in Openbox?


Solution:1

I know I can do this with keyboard shortcuts, but not with the mouse unfortunately. I do not think the openbox configuration file have support for a "on drag" mouse event.

<keybind key="W-Left">        # HalfLeftScreen      <action name="UnmaximizeFull"/>      <action name="MoveResizeTo"><x>0</x><y>0</y><height>97%</height><width>50%</width></action>  </keybind>  <keybind key="W-Right">       # HalfRightScreen      <action name="UnmaximizeFull"/>      <action name="MoveResizeTo"><x>-0</x><y>0</y><height>97%</height><width>50%</width></action>  </keybind>  <keybind key="W-Up">          # HalfUpperScreen      <action name="UnmaximizeFull"/>      <action name="MoveResizeTo"><x>0</x><y>0</y><width>100%</width><height>50%</height></action>  </keybind>  <keybind key="W-Down">        # HalfLowerScreen      <action name="UnmaximizeFull"/>      <action name="MoveResizeTo"><x>0</x><y>-0</y><width>100%</width><height>50%</height></action>  </keybind>  

If you want to do this with the mouse it will be a lot more tricky, but openbox does have mousebindings, but it does use the same actions. openbox does not really have a binding for dragging to one half of the screen though, so you will need to trigger it from something else.


Solution:2

I too have searched for this functionality, but, as ianorlin said, it doesn't seem to be possible.

In addition to his/her response, I'd recomend you look into Openbox key chain chroots. This way I was able to extend Lubuntu's default config and add some usefull combos to rearange the windows: while I'm inside the chroot I can make a window size the quarter of the screen and place it in any of the corners: upper left, upper right, etc... you get it.

Check out my -rc.xml file here. Search for the line that says <!-- My custom window controlls chroot -->, currently that is line 333.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »