Openbox: Quick Window Manipulations with Keybindings

As much as I like dwm, for my work computer I need the full capabilities of a floating/stacking window manager, which is why I use Openbox on it. I’m not complaining, Openbox is the first standalone window manager I ever used. Setting up minimal installs with Openbox has thought me most of what I know about Linux and I’m glad that I still have a use for it.

With that said, I have gotten used to window tiling, and while for some of the work I do window tiling can be detrimental, for most everything else it’s actually beneficial. You can’t really get true window tiling in Openbox, but you can get a fast workflow through custom keyboard shortcuts, and even some quasi manual tiling.

I’ve made quite a few simple keyboard shortcuts that move windows around, resizes them quickly, “snaps” them and I even got two shortcuts allowing to tile the currently active, and previously active window horizontally or vertically. Of course, this is nothing new, and the code to quickly tile two windows vertically or horizontally isn’t from me (unfortunately I don’t remember where I got it), though I did improve it a bit, but here it is, for those who might want to try it.

Keybindings, functions and code

The code needs to be added in between the <keyboard> </keyboard> tags in Openbox’s rc.xml file. “Mod4” refers to the “windows key”.

Quasi (manual) tiling & quick snapping | code
ctrl + Mod4 + v
: tile the currently active and previously active windows vertically
ctrl + Mod4 + h: tile the currently active and previously active windows horizontally
ctrl + Mod4 + c: center the active window in full screen

Mod4 + a: move the current window to the left half of the screen
Mod4 + l: move the current window to the right half of the screen
Mod4 + s: move the current window to the top left of the screen
Mod4 + k: move the current window to the top right of the screen
Mod4 + d: move the current window to the bottom left of the screen
Mod4 + j: move the current window to the bottom right of the screen
Mod4 + f: move the current window to the top half of the screen
Mod4 + h: move the current window to the bottom half of the screen

Move | code
alt + left,right,up,down
: move windows around

Resize | code
Mod4 + left,right,up,down: increase window size in corresponding direction | code
Mod4 + shift + left,right,up,down: decrease window size in corresponding direction | code
Mod4 + Alt + equal/plus: increase window size
Mod4 + Alt  + minus: decrease window size

Yes, that is a lot of shortcuts to learn. Worth it, though. Obviously, you can modify the key combos if you don’t like these.

All this stuff in action