GTK4 apps do not use adwaita dark

GTK4 flatpak apps like Solanum and ToDO-devel (from gnome-nightly) are not using the adwaita-dark theme. Previously when setting this theme through gnome tweaks or settings.ini all system and flatpak apps respected it. Now only GTK4 system apps (tested gtk4-demo native RPM) respect the dark theme, but flatpak apps do not. Is there a workaround for this? How did flatpak initially detect the dark them and install org.gtk.Gtk3theme.Adwaita-dark?

1 Like

The fastest and easiest option that I know of to resolve this challenge using this Flatseal

Steps to set a default theme for Flatpak applications: Navigate to All Applications horizontal tab —> Filesystem group —> Other files subgroup; Add the appropriate variable(s). Redo the same for Environment group. In the future, most future Flatpak applications you open will use the new theme.


Below is the same as above. But with details for those not familiar with Flatseal.

The reason why Flatpak does not automatically use your default operating system (OS) theme is that, by default, all Flatpak applications are almost fully independent of your OS. Think of two independent devices inside your device. This is much stronger security. The downside is that sometimes, you need both your devices to communicate with each other. So that they can use shared settings or anything else to your liking.

Flatseal resolve this challenge. Flatseal is a permission manager for Flatpak applications.

Steps to set a default theme for Flatpak applications:

  1. Keep in mind that the below steps will automatically set a default theme to your liking for most of all Flatpak applications. Including both the one already installed and those installed in the future. Be aware that all your Flatpak packages will be allowed to access all the theme settings on your operating system (OS). If you’re ok with this, find your next action below.

  2. Install the Flatseal Flatpak application

  3. Open Flatseal. Using Flatseal, navigate to All Applications horizontal tab —> Filesystem group —> Other files subgroup

  4. In this Other files group, on the right side, click on the small plus (+) button. Add the appropriate GTK_THEME Filesystem variable(s) for any theme to your liking. For example, for Adwaita-dark, add those two:

    ~/.themes

    ~/.icons

  5. Still using Flatseal, navigate to All Applications horizontal tab —> Environment group —> Variables subgroup

  6. In this Variables group, on the right side, click on the small plus (+) button. Add the appropriate ICON_THEME Environment variable(s) for any theme to your liking. For example, for Adwaita-dark, add this:

    GTK_THEME=Adwaita-dark

    ICON_THEME=Adwaita-dark

  7. This screenshot shows the end result for Adwaita-dark theme. Including both the theme and icons variables. See the screenshot above for an example of the final configuration.

  8. Flatseal conveniently and automatically save any added variable or change to variables. In other words, you do not need to click on any Save button. Close Flatseal.

  9. Open Flatseal. Flatseal now automatically open using the new theme you set. Congratulation. You have successfully set a new theme for most Flatpak applications.

  10. In the future, most future Flatpak applications you open will automatically and permanently use the new theme of your choosing. Easy.

  11. Optionally, if you need to set a different theme per Flatpak application, using Flatseal, navigate to <APP NAME> horizontal tab. Then redo that same steps as above. But only for this one app. This screenshot shows an example of a final result with the Calculator Flatpak Application.


Attribution and thanks to Sreenath for his publication about Flatseal at https://itsfoss.com/flatpak-app-apply-theme/

1 Like

This is excellent thanks for the simple fix! Scouring the web this is so far the only reference i have found to make flatpak apps honor the system (that works) theme adwaita-dark.

It might be good to add these steps to flathub wiki somewhere to make it more easily discoverable. Tips and Tricks

1 Like

If you’re trying to make GTK4/libadwaita (or GTK3+libhandy) apps use dark mode, you just need to set the global color scheme preference. Libadwaita will pick that up via the settings portal. How to do that depends on your portal implementation. If you’re using xdg-desktop-portal-gtk but you’re not using GNOME, you can use:

gsettings set org.gnome.desktop.interface color-scheme prefer-dark

Setting GTK_THEME in Flatseal is definitely not recommended.

1 Like

This is excellent thanks for the simple fix!

You’re welcome @CaptainMoron :slight_smile:

It might be good to add these steps to flathub wiki somewhere to make it more easily discoverable. Tips and Tricks

Thanks for your suggestion about adding those steps to Flatpak doc. Done. I sent my suggestion at Update desktop-integration.rst by Francewhoa · Pull Request #447 · flatpak/flatpak-docs · GitHub

It is pending the maintainers review. If they approve, it will likely be added at flatpak-docs/docs/desktop-integration.rst at master · flatpak/flatpak-docs · GitHub