Bug 417441 - Update ~/.xsettingsd file for all changes that affect GTK apps
Summary: Update ~/.xsettingsd file for all changes that affect GTK apps
Status: CONFIRMED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_style (show other bugs)
Version: 5.18.3
Platform: Arch Linux Linux
: HI wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 422064 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-02-11 18:38 UTC by Matej Mrenica
Modified: 2023-04-15 19:27 UTC (History)
18 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
screen recording, applying gtk3 themes on X11 (2.03 MB, video/webm)
2020-03-15 13:54 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matej Mrenica 2020-02-11 18:38:21 UTC
SUMMARY
...and the font is not antialiased.

SOFTWARE/OS VERSIONS
KDE Frameworks Version: 5.67
Qt Version: 5.14.1

ADDITIONAL INFORMATION
On wayland
Comment 1 Jan Grulich 2020-02-17 07:06:01 UTC
*** Bug 417768 has been marked as a duplicate of this bug. ***
Comment 2 Jan Grulich 2020-02-17 08:26:47 UTC
Can you be more specific? What application?

Anyway, you shouldn't be really using GTK_USE_PORTAL=1, it's not meant to be used outside Flatpak.
Comment 3 Kai Uwe Broulik 2020-02-17 08:47:47 UTC
> Anyway, you shouldn't be really using GTK_USE_PORTAL=1, it's not meant to be used outside Flatpak.

Distros do that to make Firefox use a sane file dialog
Comment 4 Jan Grulich 2020-02-17 08:50:12 UTC
(In reply to Kai Uwe Broulik from comment #3)
> > Anyway, you shouldn't be really using GTK_USE_PORTAL=1, it's not meant to be used outside Flatpak.
> 
> Distros do that to make Firefox use a sane file dialog

I know they use it for Firefox, it's just it has a side-effect and Firefox doesn't really behave the same  and expects it runs in the sandbox.
Comment 5 Matej Mrenica 2020-02-17 09:06:28 UTC
(In reply to Kai Uwe Broulik from comment #3)
> > Anyway, you shouldn't be really using GTK_USE_PORTAL=1, it's not meant to be used outside Flatpak.
> 
> Distros do that to make Firefox use a sane file dialog

Exactly, I use it globally so all apps that can (mostly FF, FF Nightly and Thunderbird), use KDE dialogs.
Comment 6 Patrick Silva 2020-02-18 11:56:43 UTC
I can confirm this issue.
I use Breeze dark global theme but rhythmbox music player and fragments torrent client installed from flathub use light theme.

Operating System: Arch Linux 
KDE Plasma Version: 5.18.0
KDE Frameworks Version: 5.67.0
Qt Version: 5.14.1
Comment 7 Jan Grulich 2020-02-19 08:58:44 UTC
My best guess is that this is because our GTK theme or whatever we apply to GTK apps is not able to read the configuration, because you tell it that the app is sandboxed and there is no support for Settings portal to make it bypass the limitation (even though there is none).
Comment 8 Benjamin Smith 2020-02-22 01:38:46 UTC
*** Bug 418016 has been marked as a duplicate of this bug. ***
Comment 9 Jan Grulich 2020-02-25 12:46:15 UTC
(In reply to Patrick Silva from comment #6)
> I can confirm this issue.
> I use Breeze dark global theme but rhythmbox music player and fragments
> torrent client installed from flathub use light theme.
> 
> Operating System: Arch Linux 
> KDE Plasma Version: 5.18.0
> KDE Frameworks Version: 5.67.0
> Qt Version: 5.14.1

For apps from Flathub I suppose you have to install org.gtk.Gtk3theme.Breeze or org.gtk.Gtk3theme.Breeze-dark, depending which one you use in your system.
Comment 10 Jan Grulich 2020-02-25 12:48:23 UTC
(In reply to Jan Grulich from comment #9)
> (In reply to Patrick Silva from comment #6)
> > I can confirm this issue.
> > I use Breeze dark global theme but rhythmbox music player and fragments
> > torrent client installed from flathub use light theme.
> > 
> > Operating System: Arch Linux 
> > KDE Plasma Version: 5.18.0
> > KDE Frameworks Version: 5.67.0
> > Qt Version: 5.14.1
> 
> For apps from Flathub I suppose you have to install org.gtk.Gtk3theme.Breeze
> or org.gtk.Gtk3theme.Breeze-dark, depending which one you use in your system.

Hmm, they seem to be quite outdated. I will try to update them.
Comment 11 Patrick Silva 2020-02-25 15:43:03 UTC
(In reply to Jan Grulich from comment #9)
> For apps from Flathub I suppose you have to install org.gtk.Gtk3theme.Breeze
> or org.gtk.Gtk3theme.Breeze-dark, depending which one you use in your system.

both are already installed on my system.
Comment 12 Jan Grulich 2020-02-26 08:25:38 UTC
(In reply to Patrick Silva from comment #11)
> (In reply to Jan Grulich from comment #9)
> > For apps from Flathub I suppose you have to install org.gtk.Gtk3theme.Breeze
> > or org.gtk.Gtk3theme.Breeze-dark, depending which one you use in your system.
> 
> both are already installed on my system.

They are outdated and built only for the old runtime so they will not work. I tried to update them, but I failed and I cannot afford to spend more time on that. You can open a bug in Flathub and see if anyone updates it or not.
Comment 13 Patrick Silva 2020-03-09 01:32:57 UTC
(In reply to Jan Grulich from comment #12)
> They are outdated and built only for the old runtime so they will not work.
> I tried to update them, but I failed and I cannot afford to spend more time
> on that. You can open a bug in Flathub and see if anyone updates it or not.

Done.
https://github.com/flathub/flathub/issues/1384

As we can read in the bug report above, flatpaks need xsettingsd on Plasma.
However, kde-gtk-config does not update ~/.xsettingsd when theme settings are modified.
Comment 14 Mikhail Zolotukhin 2020-03-10 17:55:47 UTC
kde-gtk-config updates ~/.config/xsettingsd/xsettingsd.conf file, because xsettingsd seeks it's configuration in various places, not just home directory. It works for me on kde neon dev iso.
Comment 15 Nate Graham 2020-03-10 23:02:28 UTC
So you're saying this should already be fixed, then? I guess so because I can confirm that when xsettingsd is running, visual settings get picked up by Flatpak apps.

I can't reproduce the issue.

Can someone post detailed, step-by-step steps to reproduce after verifying that xsettingsd is installed and running?
Comment 16 Patrick Silva 2020-03-11 00:42:30 UTC
In fact the color scheme of GTK3 apps installed via flatpak is not correctly updated. Furthermore, cursor is also incorrect (Adwaita instead of the one set in system settings), but this is another issue. I have this problem only on Wayland session. According to Ksysguard, xsettingsd is running on my Wayland session.

1. start Wayland session

2. set Global theme to Breeze in system settings > Global theme

3. set GTK3 theme to Breeze in system settings > Application Style >
Configure Gnome/GTK Application style

4. install the packages below from flathub:
flatpak install flathub org.gtk.Gtk3theme.Breeze
flatpak install flathub org.gtk.Gtk3theme.Breeze-Dark

5. install a GTK3 app from flathub. I installed fragments torrent client:
flatpak install flathub de.haeckerfelix.Fragments

6. open fragments (it uses Breeze GTK theme as expected)

7. close fragments

8. switch global theme from Breeze to Breeze Dark in system settings > global theme

9. open fragments again: it is still using Breeze GTK theme instead of Breeze Dark

10. restart Wayland session

11. open fragments: now it uses Breeze GTK theme as expected

On X11 fragments uses Breeze Dark GTK theme as expected
after the steps 8 and 9.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.1
Comment 17 Patrick Silva 2020-03-11 00:44:08 UTC
(In reply to Matej Mrenica from comment #0)
> SUMMARY
> ...and the font is not antialiased.

> ADDITIONAL INFORMATION
> On wayland

Already reported as bug 415933
Comment 18 Patrick Silva 2020-03-11 00:47:27 UTC
Correcting step 11:
11. open fragments: now it uses Breeze DARK GTK theme as expected
Comment 19 Nate Graham 2020-03-11 02:24:49 UTC
Thanks for the info. Will look into that.
Comment 20 Patrick Silva 2020-03-15 13:54:44 UTC
Created attachment 126808 [details]
screen recording, applying gtk3 themes on X11

Colors scheme is not correctly updated on X11 too.
Please watch the attached screen recording showing Rhythmbox and Fragments (both installed from flathub) and Nautilus (from ubuntu bionic repos) while I set GTK3 themes.
1. All apps respect Breeze dark theme;
2. flatpaks (Rhythmbox and Fragments) have light colors and Nautilus is dark after I set Breeze theme;
3. all apps have light colors after I set Default (Adwaita?) theme.

Result 2 is unexpected.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1
Comment 21 Nate Graham 2020-06-13 03:09:36 UTC
*** Bug 422064 has been marked as a duplicate of this bug. ***
Comment 22 soredake 2021-01-04 09:35:41 UTC
Any progress on this?
Comment 23 Luca Bacci 2022-11-10 14:38:21 UTC
Hello, everyone! I think that what both the OP and Patrick Silva are experiencing is that: they're using Plasma/Wayland, but somehow  GTK applications end up using the X11 backend. In that case the settings are not picked up correctly, indeed. Everything is fine instead in the common case of GTK applications running on top of the Wayland backend.

Probably GTK applications are forced to use the X11 backend because the GDK_BACKEND environment variable is explicitly set on their system. Could any of you confirm? Just open a terminal and type:

    echo $GDK_BACKEND
Comment 24 Luca Bacci 2022-11-10 14:47:07 UTC
I'm going to look into that
Comment 25 Luca Bacci 2022-11-18 13:13:34 UTC
The issue is that apps in Flatpak can read themes in ~/.themes/ but not in /usr/share/themes/.
Comment 26 Luca Bacci 2022-11-18 13:26:19 UTC
A few interesting links:

1. https://github.com/flatpak/flatpak/issues/3445
2. https://github.com/flatpak/flatpak/pull/3247
3. https://github.com/flatpak/flatpak/issues/4896

TLDR: Flatpak apps should not be able to access themes from the system. If you think about it, the system could be rather old, but Flatpaks can be updated independently to newer and newer versions. If in the future something w.r.t. theming changes, for example as happened for GTK 3.20: https://developer-old.gnome.org/gtk3/3.24/ch32s10.html, then Flatpaks will access incompatible themes.

OTOH, the PR in the second link and the fact that themes in ~/.themes can already be read suggests that it isn't considere a big problem, so there's hope :)
Comment 27 Luca Bacci 2022-11-18 13:28:52 UTC
Note: the issue I was having when using GDK_BACKEND=x11 is a different thing really, and is tracked at https://bugs.kde.org/show_bug.cgi?id=459468
Comment 28 Nate Graham 2023-04-15 03:27:02 UTC
Luca, do you know if this still relevant today with all your recent changes?