Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

KDE Plasma Wayland: Mouse cursor is not visible

Open Firlaev-Hans opened this issue 2 years ago • 19 comments

Describe the Bug

Like the title says. Using my Arch Linux PC with Plasma on Wayland as the Sunshine host, I can't see the mouse cursor in moonlight. I see the cursor move on the Sunshine PC's screen when I move the mouse on the Moonlight client device, but in Moonlight it is not visible.

Expected Behavior

The mouse cursor should be visible on the client

Additional Context

No response

Sunshine Host Operating System and Version

Arch Linux

Architecture

x86_64

Sunshine Version

0.13.0

GPU Type

AMD

GPU Model

Radeon RX 580

GPU Driver/Mesa Version

21.3.7

Capture Method (Linux Only)

PipeWire / VAAPI/ Wayland (KMS)

Firlaev-Hans avatar Mar 12 '22 10:03 Firlaev-Hans

This issue is stale because it has been open for 30 days with no activity. Remove the stale label or comment, otherwise this will be closed in 5 days.

github-actions[bot] avatar Apr 12 '22 00:04 github-actions[bot]

This issue is stale because it has been open for 30 days with no activity. Remove the stale label or comment, otherwise this will be closed in 5 days.

Well, it's still an issue currently.

Firlaev-Hans avatar Apr 12 '22 08:04 Firlaev-Hans

Same here on sway (Arch), so probably wayland related, not just KDE plasma. Everything works great except for this issue. The mouse works, since I can interact with buttons or links, but the cursor is invisible.

v44r avatar Apr 12 '22 11:04 v44r

I found this issue opened and subsequently closed on the Pipewire repo. The issue was the cursor not being present when screen-sharing in Firefox. Apparently, Firefox (actually webrtc?) was not implementing some sort of cursor metadata that Pipewire uses to determine if it should send the cursor. Could this be related to this issue? As already mentioned, it seems to be compositor independent, so the issue resulting from Pipewire interactions sounds reasonable to me.

In the meanwhile, using Gamescope seems to display the cursor. I've only tested one game, but I will be testing more soon and reporting back.

nisegami avatar Apr 28 '22 11:04 nisegami

Works in nightly

muskwasis avatar May 20 '22 06:05 muskwasis

Strange that it works for you, still cannot see the cursor here on nightly with GNOME 40.4/Wayland

voidanix avatar May 21 '22 15:05 voidanix

Strange that it works for you, still cannot see the cursor here on nightly with GNOME 40.4/Wayland

Same here, cursor not visible unless using GameScope on the latest nightly with KDE/Wayland

nisegami avatar May 23 '22 11:05 nisegami

Oh sorry I was replying to @v44r. @nisegami How are you running gamescope? I cannot get it to start using it in embedded mode. I'll give GNOME 40.4/Wayland a test as well.

muskwasis avatar May 23 '22 12:05 muskwasis

Yeah, I don't know what fixed it, but now I can see the mouse cursor, no problem (using sunshine from AUR, so still 0.13.0... maybe something in sway or wlroots fixed it?).

v44r avatar May 23 '22 15:05 v44r

I just got this issue, after updating to Plasma 5.25. I've been running Plasma with Wayland for a month or so but it just didn't occur until the update. I can sometimes see the cursor, it spontaneously appears when it's supposed to change state (but the same states aren't always visible).

lbfalvy avatar Jun 17 '22 10:06 lbfalvy

I was just able to install the latest rpm release on Fedora 36 and can also confirm that my mouse cursor is not visible in Moonlight while using KDE Plasma on Wayland on the host.

JustPlainGarak avatar Jun 21 '22 15:06 JustPlainGarak

I commented here in err, my mouse cursor was missing on a plain Wayland host without any streaming and I don't know what Sunshine is, but setting KWIN_FORCE_SW_CURSOR=1 in ~/.config/environment.d/ fixed it and from what I gather it's supposed to be a wildcard solution for a variety of problems around missing cursors. Note that .profile or other scripts aren't executed by Wayland so you can't set the variable there, and since KWin needs to read it Systemd is probably the only place it'll work. Apparently software cursors aren't very good for performance, so this isn't a long-term solution.

lbfalvy avatar Jun 23 '22 23:06 lbfalvy

I commented here in err, my mouse cursor was missing on a plain Wayland host without any streaming and I don't know what Sunshine is, but setting KWIN_FORCE_SW_CURSOR=1 in ~/.config/environment.d/ fixed it and from what I gather it's supposed to be a wildcard solution for a variety of problems around missing cursors. Note that .profile or other scripts aren't executed by Wayland so you can't set the variable there, and since KWin needs to read it Systemd is probably the only place it'll work. Apparently software cursors aren't very good for performance, so this isn't a long-term solution.

is there any equivalent solution for GNOME?

Pipyakas avatar Jul 03 '22 07:07 Pipyakas

I found this issue opened and subsequently closed on the Pipewire repo. The issue was the cursor not being present when screen-sharing in Firefox. Apparently, Firefox (actually webrtc?) was not implementing some sort of cursor metadata that Pipewire uses to determine if it should send the cursor. Could this be related to this issue? As already mentioned, it seems to be compositor independent, so the issue resulting from Pipewire interactions sounds reasonable to me.

In the meanwhile, using Gamescope seems to display the cursor. I've only tested one game, but I will be testing more soon and reporting back.

I'm using @lbfalvy workaround posted above, but I'm curious what you're doing with gamescope to work around the issue as well, as I'm not 100% sure what implications forcing a software mouse cursor has on my general computing experience.

JustPlainGarak avatar Jul 04 '22 15:07 JustPlainGarak

I'm using @lbfalvy workaround posted above, but I'm curious what you're doing with gamescope to work around the issue as well, as I'm not 100% sure what implications forcing a software mouse cursor has on my general computing experience.

I'm actually also using the software cursor workaround. I haven't noticed any issues with it yet personally.

When I said that Gamescope displayed the cursor, I meant in actual games. So if I setup Steam to launch a cursor based game using Gamescope and then launched the game while streaming via Sunshine, the cursor would be visible. However, shortly after replying I realized that Gamescope doesn't play nice with the Steam controller, making it not really a viable solution for me.

nisegami avatar Jul 05 '22 09:07 nisegami

To all using the software cursor workaround, this got fixed for me with a recent update so you may want to try removing it. I can attest that without the hack my desktop is much faster, I think it's got to do with the fact that layers can be drawn in parallel.

lbfalvy avatar Aug 04 '22 10:08 lbfalvy

Unfortunately the issue is not yet fixed for me, will have to keep using the software cursor workaround.

JustPlainGarak avatar Aug 04 '22 15:08 JustPlainGarak

No software cursor workaround available for Gnome.

kode54 avatar Oct 14 '22 23:10 kode54

This does help a lot. Another reference is here: Reddit Post. This really needs to be fixed or something than just a workaround. Because I use this when using Wayland since X11 doesn't have this issue. Not only that, but Streaming a game like Minecraft to my Steam Deck, the cursor is shown due to this workaround, but if you use the controller addon for Minecraft and move your joysticks around that would use the mouse. The mouse is invisible as well (joysticks mimicking the mouse for the addon), this workaround does nothing. But if you have the trackpads be used as mouse (the mouse keybind, not joysticks), this issue is not there. So obviously there's a lot of issues here. Hopefully gets fixed soon.

X11 does not have these inconsistencies, such as the Minecraft issue. But I enjoy Wayland much more than X11.

Anyway, a few tidbits and such.

FormBurden avatar Oct 22 '22 19:10 FormBurden

Moonlight Sway Wayland on the client Sunshine 1.60 on the windows host

When I plug a mouse into the host there is a cursor When I remove the mouse from the host there is no cursor

Nvidia gamestream works perfectly with Moonlight

BA8F0D39 avatar Dec 30 '22 02:12 BA8F0D39

Windows doesn't display a cursor if there's no mouse attached. The workaround for this is to enable MouseKeys.

kode54 avatar Dec 30 '22 04:12 kode54

For what it's worth, I just had the mouse disappear on a Ubuntu 22.04 system. Oddly enough the T2 instance I have running on a Mac Pro didn't have the problem, noticed that it was using a 6.x kernel. I manged to resolve it by upgrading the amdgpu driver and building sunshine from source. Trying to add a mouse to the headless system didn't resolve my problem, it the bug was also present in both KDE and Gnome.

jwp2987 avatar Jan 01 '23 04:01 jwp2987

For Gnome, arch, wayland, setting

MUTTER_DEBUG_DISABLE_HW_CURSORS=1

in /etc/environment seems to be working for me

But weirdly I have an extra cursor (not moving) on my screen in some windows.

akhil-rana avatar Jan 09 '23 00:01 akhil-rana

@lbfalvy In which file under ~/.config/environment.d/ do you suggest to write the line/ I added the variable in my .zshrc and it didn't help.

reza-naq avatar Jan 10 '23 18:01 reza-naq

@lbfalvy In which file under ~/.config/environment.d/ do you suggest to write the line/ I added the variable in my .zshrc and it didn't help.

tl;dr: ~/environment.d/50-kwin-sw-cursor.conf will work

~/environment.d/ is the per-user systemd environment. Any non-hidden filename should do, the convention for files in **.d/ configuration directories is to begin with two digits and a dash, as the order of execution can be specified by modifying the digits. .zshrc doesn't work because the variable should be available to kwin. Generally speaking, you can only use zshrc to customize your terminal environment, although I have successfully used bashrc to delay the launch of daemons I only need in situations where I would open the terminal. You couldn't put the variable in any other script file either, as Wayland doesn't have a startup script. That's why we use systemd to set envvars for the whole session.

Edit: this is inaccurate, see my next comment

lbfalvy avatar Jan 10 '23 21:01 lbfalvy

@lbfalvy The first time I created a file in ~/.config/enviroment.d/ it was a hidden file called .profile. After your last post I created a new one following the ordering scheme you described. Ir didn(t work either. I posted few questions here & there, KDE & freedesktop forums. No response from the 1st one and the latter were quick to close my issue. Thanks a lot for you detailed response.

reza-naq avatar Jan 11 '23 17:01 reza-naq

@akhil-rana Thanks! It works but the cursor becomes invisible when i play a video in fullscreeen.

I think this topic need to be renamed since this seems to be a general problem in Wayland.

tjssoldier avatar Jan 14 '23 22:01 tjssoldier

@reza-naq Actually my bad, the file needs to match ~/.config/environment.d/*.conf as described in man environment.d, the digit prefix is a convention. Also make sure that you don't prefix your envvar declarations with export; these aren't script files, they're parsed by systemd. The manpage should answer most of your questions.

If you want to determine whether your assignment is working, try relogging and printing the variable with echo $KWIN_FORCE_SW_CURSOR. If the variable isn't being set, the problem relates to systemd and environment.d in particular. If the variable is being set but doesn't fix the cursor issue, the problem relates to KDE and kwin.

@tjssoldier this topic needs to be moved to a different repo or a different forum even, but I've been referencing it for months so I'd rather the link didn't die. If the Sunshine team prefers it could be closed and appendable.

lbfalvy avatar Jan 15 '23 02:01 lbfalvy

@lbfalvy I'd named it actually almost as you say in your post: 10-kwin-force-sw-cursor=1. And I just checked out. The file is picked up by Wayland because echo show the value correctly. I think this regards Wayland team. I've already posted something there with no response so far. I'm using Plasma/X11 for the moment. As I check the packages list each time I update the system I'll try it again if see a Wayland upgrade. The most important is to let them now that this problem is there, at least for a configuration like mine.

Actually I say Wayland but it can be, as you say, KWIN, KDE or some driver. My knowledge comes short of saying which one.

reza-naq avatar Jan 16 '23 00:01 reza-naq

Have the same issue.

OlegAckbar avatar Feb 09 '23 11:02 OlegAckbar