Setting GTK theme on Flatpak apps#flatpak#GTK#Ansible
Whenever possible I like to install apps on my linux desktop as flatpaks. The reason for this is that they are installed in containers, keeping everything isolated. Doing this means that it is easy to get a consistent installation and running experience across different linux distributions.
The one issue that I have with flatpaks is that flatpak applications by default do not have access to your desktops GTK theme settings and try to default to using Adwaita. As someone who uses a dark theme for everything, having applications open with a retina-burning light theme is painful. I have found that setting the GTK theme for flatpak apps is in general a painful experience - checkout this github issue for further details.
If you use a common GTK theme on your desktop that is available as a flatpak app (check using
flatpak remote-ls | grep org.gtk.Gtk3theme), as long as you install the same theme as a flatpak (e.g.
flatpak install org.gtk.Gtk3theme.Adwaita-dark), then this theme should be picked up.
I, however, do not use a common GTK theme on my desktop, having created my own using Oomox. I want to be able to use a GTK theme, as close as possible to my own colour scheme to create a consistent environment. To do this I install the GTK theme I want from flathub, ensure that each flatpak has a
settings.ini file in place in the
gtk-3.0 folder that sets the desired GTK theme.
To automate this as much as possible i have written the following Ansible playbook:
This ansible playbook can be run multiple times (after each new flatpak is installed).
This is generally giving my a consistent experience but I know it is far from perfect:
- It will create a GTK settings.ini even if the flatpak does not use GTK
- Flatpak applications can use different runtimes which may need different versions of themes - This isn't causing me many issues at the minute, I will look at it again if/when this becomes a problem.