[How To] Consistent Flatpak Theming in KDE Plasma

Difficulty: ★☆☆☆☆

I use 2 Flatpaks on my system, Skype and Spotify. Yes, I know that they are in the AUR. The Flatpak versions work the best for me. The one thing that I do not like about Flatpaks, is how they ignore my GTK theming preferences that I have set in the Plasma Settings. The official solution from the Flatpak devs, is to install the wanted theme as a Flatpak. I personally think this solution is not ideal. Why have two versions of a theme installed just to fix a limitation inherent in the Flatpak system? Also, what if the theme you are using is not in the Flathub repo? For example, the theme I use for both QT and GTK applications on my KDE Plasma install, is the Dark-openSUSE theme. It is not available in the Flathub repo. It can be found here: Qt Theme and GTK Theme.

Solution #1

After some research, I found a quick and easy fix. The downside is that you need to do it for every Flatpak you have installed.

  1. Copy the following file, ~/.config/gtk-3.0/settings.ini
  2. Create a gtk-3.0 folder in the Flatpak program’s install folder. It is located at ~/.var/app/(name of program)/config/
  3. Paste the settings.ini file into the folder you created above.

Solution #2

There is a script that can “automate” the process. It works great. You can find it here, as well as below.

flatheme.sh
#!/usr/bin/env bash

for dir in $HOME/.var/app/*/
do
    confdir="${dir}config/gtk-3.0"
    mkdir -p $confdir
    cp $HOME/.config/gtk-3.0/settings.ini $confdir/settings.ini
done

To use the above script, do the following:

  1. Copy the above text.
  2. Open your favorite text editor.
  3. Paste the text from the above script into your text editor.
  4. Save the above file to your home folder or a folder of your choice. I personally named the file flatheme.sh
  5. Open a terminal window and navigate to where you saved the above script to.
  6. Make your new script executable by typing: chmod a+x flatheme.sh
  7. Run the script by typing ./flatheme.sh

You will only have to do one the above solutions right after installing a Flatpak. Updating the Flatpak will not undo the changes done.

Here are a couple of screenshots showing the results.

Spotify over Dolphin

Dolphin over Spotify

3 Likes

I have to ask which desktop are you using? Cause I usually have 12 to 20 Flatpaks and have never seen one not pickup the theme I’ve switched to. After I change all the theme components in system setting and before I closeout system settings I check various apps to make sure that I have a consistant look and feel. On a rare occasion I have to logout and back in but after that everything is themed as it should be.

As stated in the title, I am using KDE Plasma. The theming of Flatpaks was not consistent with other GTK apps in my install of Plasma. Especially when the theme is a “community” GTK theme. By doing this, everything works properly.

All I can tell you is my experience under Manjaro regardless of who made the theme everything themes without issue. now that said I recently tested openSUSE Tumbleweed and did what I always do for themes and every time there were parts that just would not theme.

I can only speak to my experience. Doing what is in my guide works in Arch, Manjaro, and KDE Neon. No issues with theming on the Flatpaks I use. Anyways, you do you.

Would you mind sharing the contents of the settings.ini file you are using? I cannot make this work. Cheers!