Hide Title Bar When Maximized in GNOME 3.16

In GNOME 3.14 and 3.12, I had a modification in metacity-theme-3.xml which basically hides the title bar from any window when it's maximized. I preferred this method to the Maximus Two extension because the extension's behavior is inconsistent where sometimes I would see a transparent bar in place of the title bar on maximized windows (usually after resuming from a suspend).

Now, in GNOME 3.16, the metacity tweak doesn't work anymore because GNOME no longer uses it. I've tried custom gtk3 css such as:

.maximized .titlebar {
    display: none;
}

and variations of that, to no avail. Is this possible to achieve through gtk-3 custom css?

Update: Pixel Saver is a good extension for doing just this without any bugs but I would still like to know if there's a way to do it manually.


To get to the core of why the metacity theme tweak no longer works we have to look at the gnome blog itself where gnome developer where Florian Müllner explains that when drawing the title bars gnome no longer uses metacity at all and they are always drawn by Gtk+

This means that a css answer is the only one that will work and I believe you are most of the way there. I read on this commit page that the css you want is somewhat like this:

.maximized .header-bar.default-decoration {
  padding: 0;
  font-size: 0.7em;
}

.maximized .header-bar.default-decoration .button.titlebutton {
  padding: 0;
  border-width: 0;
}

The reason the css can't hide or remove the element like it can with html (or svg) is that the css applies to gtk properties and the visibility of an object isn't a property in the typical Gtk way. You actually have to call widget.hide() from code. Similar to how Gimp themes have to hide widgets by making them the same colour as the background as a hack.