Remove title-bar on maximized Openbox windows

I was looking for a way to save some vertical space by hiding the title bar of maximized windows with my window manager (Openbox). It turned out to be impossible using just standard Openbox settings.

Asking on the Openbox mailing list, I found Orcsome. It's a scripting extension for NETWM compliant window managers (Openbox is one of them), which allows you to manipulate windows via simple Python scripts.

All I needed from it was for maximized windows to automatically get undecorated, i.e: for them to lose the title bar. Doing so saves some vertical space and it looks nicer, especially if the title bar is right below the taskbar.

I installed Orcsome (link to my PKGBUILD which builds the latest master from git, but it's also in the AUR if you prefer the released versions). I didn't even have to consult the documentation and write the script (config file) myself. The author and person that responded on the mailing list gave me a sample config which does exactly what I needed. I just removed the additional keyboard shortcut (I have my own). Save the Python script under ~/.config/

from orcsome import get_wm

wm = get_wm()

def on_manage():
    @wm.on_property_change(wm.event_window, '_NET_WM_STATE')
    def property_was_set():
        w = wm.event_window
        if w.maximized_vert and w.maximized_horz:
            if w.decorated:
                wm.set_window_state(w, decorate=False)
            if not w.decorated:
                wm.set_window_state(w, decorate=True)

You will also have to start Orcsome with your Openbox session. I did it using the standard autostart file in the Openbox config directory.