Hide title bars in GNOME Shell


4 min read
linux
gnome
arch linux
gnome

GNOME Shell’s title bars are just too damn big.

So big that I have been toying around with the idea of going back to a tiling window manager.

TWMs like xmonad and i3 have little to no title bar. It saves space and creates a clean aesthetic.

I’m not the only person thinks that GNOME’s title bars are too bit either.

There are least a handful of GNOME extensions out there that merge the title bar with the top panel to save space similar to how Ubuntu’s Unity does it.

Sadly most of the extensions are flaky at best and I don’t think any that I ran into run on Wayland.

In addition to the extensions, there is a never ending supply of outdated blog posts and Stack Overflow questions attempting to address the issue.

A lot of the information I was able to find was able to get me to a point that I had a very minimal title bar without a window title or close button.

Before I give you my solution, I’d like to talk a bit about what I learned with my research on the matter.

First off, the title bars are called window decorations. Helps a ton to know what to call what you’re searching.

Second, GNOME has two window decoration types, server-side and client-side.

Server-side decorations are the ones that are drawn by GNOME and are what I would consider a more traditional window decoration. This is the type that you would find on GNOME Terminal or around Chrome or Firefox.

Client-side decorations are what you would find on the “nicer” and arguably more GNOME-integrated applications. The Files application is a great example of this. The traditional title bar is replaced with more of an integrated experience where there are additional controls that live in the same space as the close button.

I don’t mind the client-side decorations as they provide value without creating additional, wasted, vertical space. Since I don’t consider those window types to be a nuisance, I only targeted the server-side decorations.

Armed with that information, and the source code for the Adwaita theme, I was able to come up with some CSS which I placed in ~/.config/gtk-3.0/gtk.css which made my windows look like this:

No title bar in Arch Linux

Well, in Debian Testing and Arch Linux it looked that way, In Ubuntu Gnome, not so much:

No title bar in Ubuntu

See the little white dots across the top of the window? Seems Ubuntu Gnome has some magical !important flag somewhere that kept me from being able to adjust the font size.

For me, I didn’t consider it that big of a deal as it was only noticeable when you don’t have a window maximized or snapped, which I rarely have windows that aren’t.

Since most of the crap I had read out there were only partial solutions, I wanted to make sure this post contained something a bit more complete.

Complete doesn’t mean perfect though, the solution I settled on was to change the color of the title text to match the theme I use, Adwaita Dark:

window.ssd separator:first-child + headerbar:backdrop,
window.ssd separator:first-child + headerbar,
window.ssd headerbar:first-child:backdrop,
window.ssd headerbar:first-child,
window.ssd headerbar:last-child:backdrop,
window.ssd headerbar:last-child,
window.ssd stack headerbar:first-child:backdrop,
window.ssd stack headerbar:first-child,
window.ssd stack headerbar:last-child:backdrop,
window.ssd stack headerbar:last-child,
window.ssd decoration,
window.ssd headerbar.titlebar {
  border-radius: 0;
}

window.ssd headerbar * {
  margin-top: -100px;
  color: #1c2022; /* May need to tweak, this matches Adwaita Dark */
}

window.ssd headerbar.titlebar,
window.ssd headerbar.titlebar button.titlebutton {
  border: none;
  font-size: 0;
  height: 0;
  margin: 0;
  max-height: 0;
  min-height: 0;
  padding: 0;
}

The mistake a lot of folks seemed to make was not getting aggressive enough with their selectors. At a certain point, you just have to say “fuck it” and toss in a wildcard and hope for the best.

I also found it interesting, especially with a web development background, that nothing I had read mentioned using a negative margin to get shit out of the way.

Fingers crossed that the use of a negative margin isn’t a bug that is going to be “fixed” in a future version of GNOME!

It’s not the most elegant solution, but it certain got me to the point of minimalism I had been searching for in GNOME Shell!