• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
WebSetNet

WebSetNet

Technology News

  • Technology News
    • Mobile
    • Games
  • Internet Marketing
  • System Admin
    • Windows 11
    • Linux
    • Mac & Apple
    • Website Scripts
      • Wordpress
You are here: Home / System Admin / Linux / Flatpak Apps Look Out of Place? Here’s How to Apply GTK Themes on Flatpak Applications

Flatpak Apps Look Out of Place? Here’s How to Apply GTK Themes on Flatpak Applications

January 12, 2022 by Martin6

One of the reasons why some users avoid installing Flatpak apps is that most Flatpak apps don’t change their appearance as per the current system theme. This makes the applications look out of the place in your otherwise beautiful set up.

flatpak apps not matching system theme
Flatpak apps do not match system theme

The official way to apply GTK themes to Flatpak apps is by installing the desired theme as a flatpak. However, there are only a few GTK themes that can be installed as Flatpak.

This means that if you found a beautiful GTK theme, your Flatpak applications will still be using their default appearance. But wait! There is a workaround.

In this tutorial, I am going to introduce you a way to make flatpak apps aware of external GTK themes.

Applying GTK themes to Flatpak applications (intermediate level)

Before we proceed, let’s understand why flatpak apps have this behavior.

Flatpak apps run inside a ‘container’, so they don’t have access to the host filesystem, network, or physical devices without explicitly setting the appropriate permission, and that is what we are going to do.

As I said earlier, this is a workaround, not a flawless solution. Don’t expect it to change the themes of Flatpak apps automatically when you change the system theme. You can, however, change it for all Flatpak apps in one single command.

Let’s see how to achieve that. Please note that this tutorial requires that you are a bit familiar with the Linux command line and you can find your way around the terminal.

Step 1: Give Flatpak apps access to GTK themes location

GTK themes are located in /usr/share/themes for all users, and in ~/.themes for a specific user.

To give all flatpak packages permission to access ~/.themes run the following command:

sudo flatpak override --filesystem=$HOME/.themes

Notice that you can’t give access to /usr/share/themes because according to flatpak documentaion they are black listed.

Alternatively, you can do this at per-application base as well. You need to specify the application ID for which you are going to change the theme.

sudo flatpak override org.gnome.Calculator --filesystem=$HOME/.themes

Step 2:Tell Flatpak apps which theme to use

Giving access to ~/.themes is not enough because this directory may contain multiple themes. To tell flatpak which GTK theme to use, first get the name of the desired theme and then apply the following command:

sudo flatpak override --env=GTK_THEME=my-theme 

As you can see in the screenshot below, there is two themes available, Ant-Bloody and Orchis-dark. Copy and paste the exact theme name in the above command:

set gtk theme to flatpak apps
Set GTK themes for all Flatpak apps

Alternatively, for individual application, run:

sudo flatpak override org.gnome.Calculator --env=GTK_THEME=my-theme 

and replace my-theme with the folder name of the theme you want to apply (and it must be located in ~/.themes).

Step 3: Test the theme change by running a Flatpak app

If the application was already running, you’ll have to close and start it again. You’ll see that the newly started application uses the theme that you had specified earlier.

Here is a screenshot of GNOME calculator and GNOME builder (Flatpak version) before the above steps:

Flatpak applications with default Adwaita theme
Flatpak applications with default Adwaita theme

And after the above steps (With Canta GTK theme):

 

Flatpak applications with Canta Dark theme
Flatpak applications with Canta Dark theme

That’s better, right? Now, I could leave you here but it would be appropriate to mention the steps for reverting the changes.

Revert the changes

You can reset the changes by resetting all the overrides at once. Please note that this will reset any previous overrides you had explicitly set.

sudo flatpak override --reset

Alternatively, you can reset permissions at package level as well:

sudo flatpak override --reset org.example.app

If you have previously overridden the GTK_THEME or filesystem for a specific Flatpak package using “flatpak override” resetting will help you set it again.

Additional information

Normal GTK applications load GTK theme specified by gsettings, you can run the following command to get currently applied GTK themes:

gsettings get org.gnome.desktop.interface gtk-theme

And to set the GTK theme, run:

gsettings set org.gnome.desktop.interface gtk-theme my-theme

To do the above with Flatpak, you have to enter a shell session inside the container of the desired application by running:

flatpak run --command=bash org.gnome.Calculator 

And inside this session, run the above command:

gsettings set org.gnome.desktop.interface gtk-theme my-theme

But that did not work with me, so I resorted to use GTK_THEME environment variable, which is supposed to be used for debugging purpose. If you managed to make gsettings work, then tell me in the comments.

I know it’s not an automated solution but at least it gives you the option to change the themes for the Flatpak applications with a couple of commands. This way, you can make the Flatpak application integrate with the rest of the system.

I hope this helped you. If you face any issues, please mention them in the comments.

Original Article

Related posts:

  1. Using Flatpak on Ubuntu and Other Linux Distributions [Complete Guide]
  2. Customize GNOME Desktop With These Tips in Ubuntu 17.10
  3. How to Install Themes in Ubuntu 17.10
  4. How To Start A Premium WordPress Blog (Step-by-Step Guide)
  5. How To Install Latest LibreOffice from Flatpak Package
  6. Customize GNOME Desktop With These Tips in Ubuntu 17.10
  7. Best Ubuntu Themes: 10 Linux Icon Themes 2019
  8. Download Icons For Ubuntu – 10 Best Icons Themes For Ubuntu
  9. Things to do After Installing Ubuntu 18.04
  10. 13 Best Dark GTK Themes for Your Linux Desktop

Filed Under: Linux Tagged With: flatpak, here's, look, place

Primary Sidebar

Popular posts

  • 5 Ways to Fix “Your SIM sent a Text Message” Issue on iPhone
  • 3 Ways to Disable GetApps on Xiaomi, Redmi, and Poco Phones Running MIUI
  • GeForce Experience not finding games? Fix it fast
  • How To Extract & Install tar.gz Files In Ubuntu
  • Discord Stream Has No Sound? 6 Ways to Fix
  • How to Highlight Duplicates in Google Sheets
  • How to check if your Android device supports Widevine DRM
  • 8 Best Sites to Read Manga Online for Free
  • Exclamation Mark on Network Signal, Mobile Data Not Working? 8 Ways to Fix
  • How to find a lost Apple Pencil using your iPad (1st and 2nd gen)
  • 3 Ways to Hide Tabs in Google Chrome
  • How to Fix YouTube Server Connection Error [400] on Android
  • How to Track a Stolen or Lost Nintendo Switch
  • What is Android System Intelligence, and why is it on your phone?
  • How To Search On Google Using Image or Video
  • Microsoft Edge's newest feature? Shopping in Microsoft Edge
  • How to Change the Last Modified Date, Creation Date, and Last Accessed Date for Files and Folders

Footer

Tags

Amazon android Apple Asus available download: edge feature features first free from galaxy Game games gaming gets google install Intel iPhone launches linux Microsoft more OnePlus phone release released review: samsung series support this Ubuntu update using video watch what will windows with xbox your

Archives

  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org