[How-To] Consistent app theming on the XFCE desktop

This topic still brings confusion, so i will try to write a short explanation/tutorial/example/summary.

First, the theory in short. The problem is, linux is an open system. There are many desktop environments and frameworks, each with its own theming engine/framework. So the only thing we can do, if we want to use programs for a different framework like KDE apps on XFCE for example, is to have the two different themes for the two frameworks and try to match them. Ideally the theme creators have made versions of the same theme for both. Not so ideally, we have to try to find a very similar equivalent of our favorite theme for the other framework and live with that.

For this tutorial i will use the currently default dark theme - Matcha. So, here we go, step by step:

  1. By default XFCE uses gtk ver. 3. There may be very few old programs using ver. 2, i personally have not seen one for quite a while. To select a theme for manjaro, which means vor gtk3, we go to Settings - Appearance. Here we select Matcha-Dark-Sea. (if it is not in the list, the corresponding package to be installed in the package manager is matcha-gtk-theme)

  2. Next, we might have some apps made for gnome. Although most of the apps made for the gnome desktop have analogs for xfce, there might be some useful apps that we want to install. Typical examples are the space analyzing app baobab or the GUI for journal reading gnome-logs. Actually, even the default manjaro packet management app - pamac, has version for gnome resp. gtk4 (pamac-gtk) and for xfce (pamac-gtk3) so instead of tweaking the theme we can just select the corresponding version. This is however, a rare luxury. Most of the apps will have only one version.
    The current version of gnome uses gtk ver. 4 and a library called libadwaita, which is kind on not very opensource-like approach and very unfriendly to other desktops. As a result, theming those apps with some custom theme is pretty much impossible or at least pretty hard. Luckily, libadwaita looks ok, the only immediately noticeable difference being the color of the close/minimize/maximize buttons in the titlebar. We still have a problem though, the default theme is white, so we have to switch to the dark version.
    There is no one click way to do this. There is a solution suggested in the following topic:
    [How-To] Fix appearance of Gtk4 apps with dark themes on Xfce
    after we make sure the package adw-gtk3 is installed, we either copy the files from /usr/share/themes/adw-gtk3-dark/gtk-4.0/ to ~/.config/gtk-4.0/ (and we have to redo this on major updates of libadwaita) or we symlink them there so that is will be set and forget as described here Pamac not following system themes (Plasma) - #77 by trinitronx
    Basically, we do (you have to delete ~/.config/gtk-4.0 if you already have it)

ln -s /usr/share/themes/adw-gtk3-dark/gtk-4.0 ~/.config/gtk-4.0
  1. We now come to apps made for KDE or using Qt5 or Qt6 framework. Widely used examples are qbittorrent and audacious music player.
    3.1 Make sure you have package qt5ct installed. Start it and select kvantum-dark theme there
    3.2 Start Kvantum manager. Select Matcha-Dark (modified) there. If you do not see it in the list, make sure you have the package kvantum-theme-matcha installed. At some point it got removed, then added back…yes, it might be not actively maintained anymore, but there is no alternative and it still works.
    3.3. If you get a warning at the top of the Ct5 settings about a QT variable and some apps apply a light instead of dark theme, that is due to a recent change in lightdm causing the .profile file not to be sourced anymore. You can either manually copy the lines from ~/.profile to ~/.bash_profile , OR link it in like adding
    [[ -f ~/.profile ]] && . ~/.profile
    to ~/.bash_profile as written here
    [Stable Update] 2024-02-21 - Kernels, KDE, VirtualBox, Calamares, ROCm, Firefox, Thunderbird - #193 by nikgnomic
    or here Xfce theming issues with some applications green others blue - #5 by nikgnomic
  1. Appimage, SNAP, Flatpak. Well, those are all kind of containerized apps and as such they have no or limited access to system themes.
    I personally use flatpaks, and a quick and dirty fix to get some dark theme there is to install Flatseal, and for each app in the section Environment to add a variable either GTK_THEME=Adwaita-dark if the app is a gnome app or QT_STYLE_OVERRIDE=Adwaita-Dark if it is a QT one. In the last scenario you might need to install org.kde.KStyle.Adwaita
flatpak install org.kde.KStyle.Adwaita

Note that there are different versions and not all of them contain Adwaita theme. I tried 5.15-23.08 and it did not work, however 5.15-22.08 works.

2 Likes

After the update from

we now have Plasma and QT6 as defaults. Of course, some apps are still using qt5, so we now have a “nice” mix of both worlds (as if the different theming for gtk2,3,4,flatpaks,qt5 etc. was not enough :slight_smile: )
So, the first thing we have to do to restore the look of QT apps after this update is to install kvantum-qt5. This will restore the look for the apps, they will use kvantum and the selected theme, like matcha-dark-sea for example.

The next problem is that many apps, like qbittorrent or ark, are qt6 apps. After the update, QT6 scales automatically for high DPI resolutions…but obviously in a different way than XFCE. So if you have scaled XFCE in the Appearance Settings from the default 96px, to, for example 120p, the QT apps will be uncomfortably big. So to achieve the same level of scaling, we actually have to scale QT down…

this is done with adding the line

export QT_SCALE_FACTOR=0.8

in your .profile (see above!!)
0.8 or 80% is an example.

Unfortunately, QT_SCALE_FACTOR fixes the qt6 app but completely breaks everything qt5.

A fix for that (thanks to @gschwarz) is to add

export GTK_THEME=Matcha-dark-sea

to .profile Do not forget to source the profile as written above and to re-login.