Score:4

How to reduce the height of headerbar (titlebar) of GTK3 apps using CSD?

us flag

The height of title bar in GNOME is really wide. Is there a way to make it narrow without installing any extension or theme? Title bar of File manager and Terminal is wide and looks ugly. I love how narrow the title bar of Unity on Ubuntu was. I'm on Ubuntu 20.04 GNOME: 3.36.8

Nmath avatar
ng flag
GNOME is not designed for users to make these kinds of changes. If you want this type of fine tuned control over your desktop, you may be better of choosing a different [flavor](https://ubuntu.com/download/flavours). The design choice of GNOME devs is to be uncomplicated and easy to use. This comes at the expense of being able to change every little thing. Kubuntu (KDE) and Xubuntu (Xfce) take a different approach and prioritize user customization. You can try these from a live session so you don't have to make changes to your installed system.
mchid avatar
bo flag
@Nmath While the default settings don't exist, you can [easily edit a css file to change the height or use gnome tweaks and/or with a gnome shell extension to customize the interface](https://www.reddit.com/r/gnome/comments/hcsq1r/is_it_possible_to_make_the_top_bar_smaller/).
mchid avatar
bo flag
FYI, the `/home/.themes` directory referenced is actually `~/.themes`. you might have to create this directory if it does not already exist.
Scott Stensland avatar
ir flag
also see https://unix.stackexchange.com/questions/276951/how-to-change-the-titlebar-height-in-standard-gtk-apps-and-those-with-headerbars/291040#291040
Score:4
cn flag

Surprisingly, this common question apparently was never posted here before - I searched a duplicate in vain.

Gnome does not expose detailed tweaking of the appearance to the users. It does not even expose changing a theme - you need to install Gnome Tweaks for that.

The easiest option to change the height of a title bar is to change to a appropriate theme. This, however, is an all-or-nothing approach. You have to take the entire theme as is.

You probably better of with some manual coding. Create a file ~/.config/gtk-3.0/gtk.css and enter or adapt the following css code:

headerbar entry,
headerbar spinbutton,
headerbar button,
headerbar separator {
    margin-top: 0px; /* same as headerbar side padding for nicer proportions */
    margin-bottom: 0px;
}

headerbar {
    min-height: 24px;
    padding-left: 2px; /* same as childrens vertical margins for nicer proportions */
    padding-right: 2px;
    margin: 0px; /* same as headerbar side padding for nicer proportions */
    padding: 0px;
}

Log out and then back in for the changes to take effect (or reset Gnome Shell with Alt+F2, r when on Xorg).

enter image description here

Foliate Ebook reader before changing gtk.css

enter image description here

Foliate Ebook reader after changing gtk.css

us flag
Works great. Did not know this was possible. Thanks.
us flag
This does not seem to change the height of headarbars of apps using libhandy.
yaa__ avatar
us flag
@vanadium it worked for some default apps like Nautius and terminal but funnily not working with Foliate Ebook reader. and Foliate changed its theme to light even though my primary theme on the system is dark. it did not work on Gedit too
vanadium avatar
cn flag
Could be because these are installed as a snap or as a flatpak. It may also depends on the size of the controls that these apps put in their header bar.
us flag
@yaa__ Did you try the Foliate PPA?
yaa__ avatar
us flag
@ArchismanPanigrahi I installed Foliate via flatpak. I was just curious whether the titlebar can be reduced in size or not. and i dont like using too many PPAs. But thanks for all the responses.
us flag
@yaa__ It is really upto you, but "PPAs are harmful in general" is just a myth. The reduced titlebar should work with Foliate from PPA (works for me in XFCE).
us flag
This also works for natively installed GTK4 apps (have not checked flatpaks).
be flag
Worked for me, thank you.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.