ToffelBlog

How I got GTK and Qt to look consistant on my Linux desktop

Published on 2020-07-19

GTK and Qt applications with the same theme. You almost can't tell the difference.

The first step for a uniform look across GTK and Qt is to find a theme that has both a GTK and Qt version. Sadly there doesn't seem to be many, due to the high amount of upkeep required to maintain both versions.

The only two that have parallel versions are the default GNOME theme (Adwaita) or the default KDE Plasma theme (Breeze).

I decided on the Plasma theme. In order to get the full theme installed I needed to install the following packages in Arch Linux:

sudo pacman -S breeze breeze-gtk breeze-icons

Lets start by setting the GTK theme.

Some desktop environments provide a way to change this in their settings. GNOME users should use the tweak tool. Users of window managers should use the excellent lxappearance to set GTK themes.

Upon setting your theme/icons, LXAppearance will generate the following config files:

~/.config/gtk-2.0/gtkrc-2.0:

# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.

include "/home/user/.gtkrc-2.0.mine"
gtk-theme-name="Breeze"
gtk-icon-theme-name="breeze"
gtk-font-name="Sans 10"
gtk-cursor-theme-name="Adwaita"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintfull"

~/.config/gtk-3.0/settings.ini:

[Settings]
gtk-theme-name=Breeze
gtk-icon-theme-name=breeze
gtk-font-name=Sans 10
gtk-cursor-theme-name=Adwaita
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle=hintfull

GNOME/GTK, loving to do their own things, have appeared to switch the method in which GTK3 themes are set. GTK applications ignored the GTK3 config file, and I found that gsettings must be used to set it:

gsettings set org.gnome.desktop.interface gtk-theme Breeze
gsettings set org.gnome.desktop.interface icon-theme breeze

Now that GTK is set we will look at Qt.

If you are not using KDE Plasma, Qt will force the (rather ugly) "Fusion" theme by default, this can be overridden by the following environment variable:

export QT_STYLE_OVERRIDE=Breeze

Now you just need to find a way to set this automatically on each login. Here is where that command should be copied to depending on what you use:

But the Arch wiki has a pretty good page about it.


Well I hope everyone found this guide useful, I got most of this info from the Arch Wiki page "Uniform look for Qt and GTK applications".

I would recommend reading it if anyone is interested in possible alternatives. The article lists alternate theme engines which can help mimic popular GTK themes if you're interested.

I noticed that the text on inactive Firefox tabs was a bit difficult to read with breeze-gtk. According to the bug tracker this seems to be FF's fault, and there is a bug opened. You can get around this by enabling the title bar in FF's Customise menu.

This exposes the fun of GUI toolkits. Most software is only ever designed with the default theme in mind, and will cause plenty of unintended behaviour. That is the reality of complicated software.