Flatpak applications are sandboxed and hence cannot access any other files on your system, while this is a good practice for privacy reasons, there are downsides to using Flatpaks as well. The downside is all the Flatpak applications take up large space on your disk, and they do not respect your Desktop theme.
While you could attach more storage to your PC or live without a few 100 megabytes on your disk, you surely cannot live without the beautiful Dark mode on any application.
In this tutorial, I will show you how to set up GTK or QT themes on Flatpak applications via several methods.
Also read: How to set up and enable Flatpaks on Linux
Why do Flatpak applications not respect your theme?
As mentioned earlier, Flatpak applications run inside a ‘container’ and they do not have any access to the host file system, physical devices, or network if you haven’t given them any appropriate permissions. You can manually give the applications permission to access your theme and icons folder in order to detect the themes and apply them.
Now, you can do so using either the command line or using the Flatseal application from Flathub.
Applying GTK themes via the command line
Let’s now go over the steps to apply GTK themes via the command line to a Flatpak application.
Give appropriate permission to Flatpaks
Themes are stored locally for any user in the
~/.themes directory and the icons are stored in
~/.icons folder. But if you have installed any theme from the package manager (DNF, Pacman or APT) then they are stored in
Now, you cannot give Flatpak applications the access to /user/share/themes and /usr/share/icons directory because it is blacklisted according to the Flatpak documentation. So let’s try giving it access to local themes and icons directories instead, from the Terminal, type the following commands :
sudo flatpak override --filesystem=$HOME/.themes
sudo flatpak override --filesystem=$HOME/.icons
You can also give permission to the Individual applications if you do not like giving all the Flatpaks installed on your system permission to see the content of ~/.themes and ~/.icons directory. You can do so by typing the command like this along with the application ID of the application:
sudo flatpak override org.videolan.VLC --filesystem=$HOME/.themes
sudo flatpak override org.videolan.VLC --filesystem=$HOME/.icons
Specify the Theme and Icon set
Now that you have given appropriate permissions to the application, you can set up any theme located in your ~/.themes and ~/.icons directories. To do that, you have to type the following command:
sudo flatpak override --env=GTK_THEME=THEME-NAME
sudo flatpak override --env=ICON_THEME=ICON-THEME-NAME
Now, simply restart your application, and you will see that your specified theme has been applied.
Similarly, you can set up Individual themes for each Flatpak application if you specify the application ID as well:
sudo flatpak override org.videolan.VLC --env=GTK_THEME=THEME-NAME
sudo flatpak override org.videolan.VLC --env=ICON_THEME=ICON-THEME
Applying Themes with the Flatseal application (Graphical Method)
If you don’t like using the Terminal or you are not comfortable typing commands every time you change your system theme, then the Flatseal application might be the solution for you. It can help you manage the permissions for the Flatpak application in a Graphical way. You can install it from FlatHub by typing:
flatpak install flathub com.github.tchx84.Flatseal
Now, launch the application from the Application Grid/Menu and then go to the ‘File Permissions’ section. Now, add ~/.themes and ~/.icons in the ‘Other Files’ menu like this:
Now, navigate to the ‘Environment’ section and add your theme there like this:
Restart all the applications for changes to take effect.
Similarly, you can set up the theme for each individual application by going through the environment variable of each application.
Hopefully, you have learned in this tutorial the methods of changing themes of Flatpak applications using either the Graphical or the command line method. Note that every time you change the system theme, you have to manually change the Flatpak theme as well.