Bug 418936 - On Wayland, third-party cursor theme is not applied to GTK3 apps installed via flatpak
Summary: On Wayland, third-party cursor theme is not applied to GTK3 apps installed vi...
Status: REPORTED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_cursortheme (show other bugs)
Version: 5.18.3
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-16 19:21 UTC by Patrick Silva
Modified: 2024-04-02 05:30 UTC (History)
9 users (show)

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


Attachments
Video guide! (2.75 MB, video/mp4)
2021-02-18 13:04 UTC, soredake
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-03-16 19:21:51 UTC
SUMMARY
On X11, cursor theme is applied as expected to GTK3 apps installed via flatpak.
But on Wayland the same apps always use Adwaita cursor theme.

STEPS TO REPRODUCE
1. start Wayland session
2. make sure your current cursor theme is NOT Adwaita in system settings > cursors
3. install any GTK3 app via flatpak/flathub (I installed pulseeffects, Transmission torrent client
and Rhythmbox music player)
4. open the just installed GTK3 app and hover over it 

OBSERVED RESULT
when we hover over the GTK3 app, cursor changes to Adwaita theme.

EXPECTED RESULT
GTK3 apps installed via flatpak should respect the cursor theme set in system settings > cursors
when running on Wayland.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.1
Comment 1 Nate Graham 2020-07-17 14:20:13 UTC
Is this something we can set with xsettings maybe?
Comment 2 Mikhail Zolotukhin 2020-07-17 14:26:40 UTC
(In reply to Nate Graham from comment #1)
> Is this something we can set with xsettings maybe?

Xsettings, as far as I know, is for X11 only.
Comment 3 Mikhail Zolotukhin 2020-07-17 14:39:29 UTC
Cannot reproduce on latest KDE Neon Unstable. Could you reproduce?
Comment 4 Patrick Silva 2020-07-19 14:08:59 UTC
Tested these gtk3 apps from flathub:
PulseEffects                
News Flash                                                     
Transmission torrent client                
HandBrake                                  
Celluloid
Rhythmbox
Swell Foop

When I use Breeze cursor theme, the problem is still happening but currently it is random and harder to reproduce. Generally it occurs when I open the app for the first time after login to Wayland session, and the app uses the correct cursor theme after it to be restarted 1 or more times.
When I use a third-party cursor theme like Night Diamond (Red) from https://store.kde.org/p/1295073/, the problem consistently affects almost all GTK3 apps mentioned above (only handbrake and Transmission always use the third-party cursor theme on my system).

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.73.0
Qt Version: 5.14.2
Comment 5 Nate Graham 2020-07-19 22:54:18 UTC
Thanks for the information!
Comment 6 soredake 2021-01-04 09:35:14 UTC
Any progress on this?
Comment 8 Patrick Silva 2021-02-18 10:44:16 UTC
(In reply to soredake from comment #7)
> https://bugs.launchpad.net/ubuntu/+source/kubuntu-meta/+bug/1915714

xdg-desktop-portal-gtk 1.6.0 is already installed on my system
and the situation remains the same as explained in comment 4.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.21.80
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 9 soredake 2021-02-18 10:51:53 UTC
(In reply to Patrick Silva from comment #8)
> (In reply to soredake from comment #7)
> > https://bugs.launchpad.net/ubuntu/+source/kubuntu-meta/+bug/1915714
> 
> xdg-desktop-portal-gtk 1.6.0 is already installed on my system
> and the situation remains the same as explained in comment 4.
> 
> Operating System: KDE neon Unstable Edition
> KDE Plasma Version: 5.21.80
> KDE Frameworks Version: 5.80.0
> Qt Version: 5.15.2
> Graphics Platform: Wayland

It's not started by default, see how to fix this https://github.com/flatpak/flatpak/issues/2861#issuecomment-7424219
Comment 10 Patrick Silva 2021-02-18 12:42:42 UTC
I have added XDG_CURRENT_DESKTOP=KDE:GNOME to /etc/environment file
and the bug persists even after re-login.
Comment 11 soredake 2021-02-18 12:45:06 UTC
(In reply to Patrick Silva from comment #10)
> I have added XDG_CURRENT_DESKTOP=KDE:GNOME to /etc/environment file
> and the bug persists even after re-login.

https://github.com/flatpak/flatpak/issues/2861#issuecomment-742421920 link fixed, do as guide says, and it will work, at least for kubuntu/kde neon.
Comment 12 Patrick Silva 2021-02-18 12:56:53 UTC
I have followed the instructions in your link but adding

[Service]
Environment="XDG_CURRENT_DESKTOP=KDE"

No change. Cursor theme is still not respected by some GTK3 flatpaks.

Thanks for your help anyway.
Comment 13 soredake 2021-02-18 13:03:55 UTC
(In reply to Patrick Silva from comment #12)
> I have followed the instructions in your link but adding
> 
> [Service]
> Environment="XDG_CURRENT_DESKTOP=KDE"
> 
> No change. Cursor theme is still not respected by some GTK3 flatpaks.
> 
> Thanks for your help anyway.

xdg-desktop-portal-gtk will start only if XDG_CURRENT_DESKTOP contains sway.
Comment 14 soredake 2021-02-18 13:04:09 UTC
Created attachment 135846 [details]
Video guide!
Comment 15 Patrick Silva 2021-02-18 13:16:13 UTC
Thanks for the video.
That's weird because sway is not even installed on my system.
I have tried using "sway" anyway but the problem persists.
I'm using red variant of Night Diamond cursor theme
( https://store.kde.org/p/1295073/ ) and Rhythmbox music player from flathub
in my tests.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.21.80
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Graphics Platform: Wayland
Comment 16 soredake 2021-02-18 13:21:00 UTC
(In reply to Patrick Silva from comment #15)
> Thanks for the video.
> That's weird because sway is not even installed on my system.
> I have tried using "sway" anyway but the problem persists.
> I'm using red variant of Night Diamond cursor theme
> ( https://store.kde.org/p/1295073/ ) and Rhythmbox music player from flathub
> in my tests.
> 
> Operating System: KDE neon Unstable Edition
> KDE Plasma Version: 5.21.80
> KDE Frameworks Version: 5.80.0
> Qt Version: 5.15.2
> Graphics Platform: Wayland

>That's weird because sway is not even installed on my system.
Some portal is deciding to start or not xdg-desktop-portal-gtk based on XDG_CURRENT_DESKTOP env, if it contains "KDE" portal will not be started, if "sway" or "GNOME" it will be started.

>I'm using red variant of Night Diamond cursor theme
Custom cursor themes in flatpak is another problem https://github.com/flatpak/flatpak/issues/709
Comment 17 Patrick Silva 2021-02-18 13:48:31 UTC
Thank you for clarifying :)
Currently Breeze cursor theme is correctly applied to gtk3 flatpaks installed on my system even without the instructions from flatpak bug report.
I'm giving a more accurate title to this report right now.
Flatpak in general is still a mess with annoying bugs. :(
Comment 18 Patrick Silva 2022-02-01 12:28:39 UTC
Still an issue. Tested Rhythmbox music player and Celluloid video player from flathub with Radioactive cursor theme from flathub.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.24.80
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.3
Graphics Platform: Wayland
Comment 19 Patrick Silva 2022-11-01 13:08:03 UTC
This bug persists on neon unstable. Workaround:
1. install Flatseal from flathub and open it
2. select your gtk app
5. scroll down to 'Filesystem' section
4, enable 'All user files'

However, this does not work with all gtk apps. Audacity and Deluge torrent client, for example, are still using incorrect mouse pointer.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Graphics Platform: Wayland
Comment 20 farline99 2023-02-21 14:25:33 UTC
The error still exists. Arch Linux, Plasma 5.27, Frameworks 103, Wayland. The solution from soredake worked right away, but I think this error is unacceptable. Link to the solution https://github.com/flatpak/flatpak/issues/2861#issuecomment-742421920
Comment 21 Lorenz Hoffmann 2024-03-09 19:12:32 UTC
This seems to be reverse in Plasma 6 Wayland: I have the correct cursor in Gtk windows (Firefox, Inkscape, Easy Effects), but the wrong one in Qt windows (Kile, Tokodon).
Comment 22 Patrick Silva 2024-03-10 11:38:46 UTC
(In reply to Lorenz Hoffmann from comment #21)
> This seems to be reverse in Plasma 6 Wayland: I have the correct cursor in
> Gtk windows (Firefox, Inkscape, Easy Effects), but the wrong one in Qt
> windows (Kile, Tokodon).

Can reproduce with Tokodon from flathub. File a new bug for Qt apps please.

Operating System: Arch Linux 
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Graphics Platform: Wayland
Comment 23 Lorenz Hoffmann 2024-03-10 16:28:47 UTC
(In reply to Patrick Silva from comment #22)

> Can reproduce with Tokodon from flathub. File a new bug for Qt apps please.

Done: https://bugs.kde.org/show_bug.cgi?id=483131
Comment 24 Jakub Kusal 2024-03-26 11:39:18 UTC
Found out solution (at least for me) from Arch Wiki: (https://wiki.archlinux.org/title/XDG_Desktop_Portal#Poor_font_rendering_in_GTK_apps_on_KDE_Plasma).
Run the command: "/usr/lib/xdg-desktop-portal --replace".
It requires to xdg-desktop-portal-gtk to be installed. I ran this command once, and now every flatpak GTK app works corretcly with cursors, even after reboots.