How to limit cursor to a window or display?

I am using KDE Plasma with Wayland. The main problem is that some games do not lock the cursor in the window so it moves to another display.
I know about gamescope but I cannot properly use it because I have nvidia and since some time ago gamescope is mostly broken.

X11 until / if it’s fixed?

1 Like

X causes issues for me like black screens or artifacts that waylands doesn’t, so it is no option.

1 Like

A lot of games have the option to switch between Windowed, Borderless Windowed and Fullscreen. Try to switch from Borderless Windowed to Fullscreen, if you are using Borderless Windowed.

I am aware but while most games do work fine some don’t no matter whether I use fullscreen, windowed or borderless.

I would still try that for that specific game since Wayland still tends to break things every now and then. If it does work for that game you have a solution and if it doesn’t you will have a least tried it, you have nothing to lose. Keep in my that all your Games are most likely running through Xwayland.

I meant that I did try switching fullscreen/borderless/windowed but it didn’t help for that game.

1 Like

Just buy an AMD gpu, just kidding(I have an Nvidia gpu as well)! :wink: Just curious what game are you having issues with, I have an Nvidia gpu as well but I recently switched back to Xorg because of stuff breaking on Wayland every now and then I got annoyed switching back and forth between the two.

Death Stranding in this case. I have both amd igpu and nvidia dgpu with DE running on amd so it might be the reason I am not facing too many issues.
Some time ago I have tried specifying amd igpu for gamescope but stuff didn’t work.

I would buy the game to test it out but I find it too expensive just to test it out, if it were cheaper I might have done it. What you could try is try testing both, first disable your igpu and then try running the game to see if the escaping screen issue is still happening and then enable it again and disable your Nvidia gpu and then see what happens then. Then you will at least know which of the two is the cause.

Troubleshoot your issues with X?

Nah, that’s crazy talk, let’s just use a totally broken, featureless and experimental protocol for which compositors are implemented willy-nilly without any adherence to the standard (because the standard is broken and inadequate) and complain on the forum that it doesn’t work as expected.


bUt iT’s mOrE seCuRE!1 :parrot:

No, it isn’t.

I have tried troubleshooting xorg, no one could advice me anything helpful I couldn’t find in a few minutes looking around, reading docs and old forums did not help me. I did even ask something on this forum to no result.
Decided then to try wayland and to my surprise it at least doesn’t break displays with black screens after a while nor gives me weird artifacts. By itself it is not great but at least it is not broken as much.

I am aware of that but it is beyond the scope of locking cursor problem. I do not use optimus, just two gpus in desktop.
The problem itself could be with steam as when I tried running the game without the cursor locked itself properly. Disabling overlay changes nothing, weird.

1 Like

I had the impression you were running a Hybrid graphic setup with two gpu’s. Then just disable one of the gpu’s at a time to test for each gpu you if that problem is still occurring when you use that specific gpu?

If I can find that game cheap somewhere I will buy it to test it out on my Nvidia gpu with Wayland. Are you using Steam to run it?

I have figured out a bandaid sort of the way but it is here I must believe there should be a better way.

Yeah you could disable one of your monitors when playing that specific game.

The issue exists if I run it on steam, the issue doesn’t exist if I don’t run it with steam. Never noticed it before because I used gamescope until it broke.
I do not believe it is worth to waste money just to check it out, I would prefer some more general solution to the issue than some specific game tweak.