Bug 447755 - GTK apps are themed on X11/XWayland but not on wayland
Summary: GTK apps are themed on X11/XWayland but not on wayland
Status: RESOLVED DOWNSTREAM
Alias: None
Product: Breeze
Classification: Plasma
Component: gtk theme (other bugs)
Version First Reported In: 5.23.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Janet Blackquill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-31 22:57 UTC by p3dimaria
Modified: 2022-08-26 10:54 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description p3dimaria 2021-12-31 22:57:56 UTC
SUMMARY
See https://github.com/NixOS/nixpkgs/issues/152914 
We're using EasyEffects as example app.
Note that the problem persist even with GTK_THEME=Breeze

OBSERVED RESULT
https://user-images.githubusercontent.com/6931743/147820677-6255a64e-0b61-4e2c-9260-0bd3136d6236.png

EXPECTED RESULT
https://user-images.githubusercontent.com/6931743/147840481-c62ff78d-4fad-4371-92c7-fda345ac3de2.png

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: nixos-unstable/(available in About System)
KDE Plasma Version: Plasma 5.21
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 p3dimaria 2022-01-03 01:29:39 UTC
Ok the plasma version is actually 5.23.3,while Qt is at 5.15.3
Comment 2 p3dimaria 2022-01-16 14:55:42 UTC
Also as additional data point if I run MOZ_WAYLAND_ENABLE=1 firefox firefox does not take the colors from the surrounding Breeze theme anymore,unlike again on X11 or even XWayland
Comment 3 p3dimaria 2022-01-16 18:04:56 UTC
Lutris additionally seems to not pick cursors and character but seems perfectly capable of picking the color scheme?
https://user-images.githubusercontent.com/6931743/149671973-56ffa54d-d079-4e5e-9b56-90e2e6781ce9.png
Comment 4 p3dimaria 2022-01-16 20:40:15 UTC
> It is probably better to open a separate issue about GTK 3-based apps.

I suspect  that there is the same underlying problem: on wayland gtk{3,4} apps do not take the correct gtk setting from the theme

> And for Firefox, do you perhaps set `GTK_USE_PORTAL=1`? With that enabled, the file chooser will be displayed by a different process, which might be running in a scope that does not include your session’s environment.

Yes but I was not talking about the file chooser

![immagine](https://user-images.githubusercontent.com/6931743/149676441-d496527c-31f6-46c8-9b31-1c821f1e81d2.png)

So to recap:
* Okular is how I want them to look, with a darker background
* Lutris (GTK4) takes the color scheme but not the fonts
* Firefox (GTK3) do not take anything from the environment

Further discussion on https://github.com/NixOS/nixpkgs/issues/152914
Comment 5 Janet Blackquill 2022-02-17 14:42:38 UTC
This, honestly, looks like an issue with interactions between GTK and NixOS's way of setting up a system, or just a packaging issue in general. From my understanding, this is only happening under a Nix environment, and we haven't gotten similar bug reports for other distros. Tentatively marking as a downstream issue; do reopen if you can reproduce outside of a Nix environment.

Just FYI to help you debug it: GTK config isn't managed by env vars, but by gsettings/.inis on Wayland and the xsettingsd/.inis on X11. See also kde-gtk-config.
Comment 6 edy.burt 2022-08-26 10:54:32 UTC
So I just resolved this for myself, but it was confusing and here is the rough chain of events (also posted to https://github.com/NixOS/nixpkgs/issues/180720#issuecomment-1228334905):

- was only happening on Wayland for me
- `GTK_THEME=Breeze` (or `Breeze-Dark`) seems to work to fix it on every app I tried
- https://github.com/NixOS/nixpkgs/issues/155291#issuecomment-1014772774 made me look at `dconf-editor /org/gnome/desktop/interface`, and shockingly, *only some of the `~/gtk-{3,4}/settings.ini` entries* (that Systems Settings set) were there - notably absent: `gtk-theme`
- going into Systems Settings -> Appearance -> Application Style -> GNOME/GTK, then selecting *the same entry* from the dropdown, and clicking Apply (which I didn't expect to become available, since I didn't change entries), fixed it *instantly* (I saw a VSCode Help -> About dialog get the right title bar as I pressed the button)

My best guess so far is that something deleted some of the entries (or migrated the `.ini`s but only partially?), but I have no idea what or when. On a different machine (with some shared history) where `dconf` is missing, I don't even have a `~/.config/dconf` at all, so it likely happened only on this one, after switching to Plasma/Wayland.

I'm mostly posting this in case other people are searching for how to fix their system:
- make sure you have `dconf`
  - for NixOS specifically: `programs.dconf.enable = true;` (maybe it should be enabled by default for plasma5, just like e.g. kde-gtk-config is?)
- run `dconf read /org/gnome/desktop/interface/gtk-theme` to confirm that it is in fact incorrect
- go in System Settings and set the Application Style GTK theme *again*