I would like to prevent my mouse from leaving the current screen it is on after pressing a key combination. (Multiscreen setup)
On Windows, this can be accomplished by DualMonitorTools where one can assign a shortcut to "lock cursor on current screen".
I traversed the whole internet in search of a similar tool for ubuntu, though to no avail. The only solution I found does not prevent the mouse from leaving, rather it pulls the cursor back into the screen which looks wonky and does not help when trying to hit a scrollbar on the right side of the screen, for example.
I also found https://github.com/pfanne/mousejail (under the hood uses XFixes) which restricts the mouse movement perfectly to a certain window, though my goal is to have it restricted to the whole display.
I tried utilizing DualMonitorTools through wine, though it can't recognize the display properties. I know I can move the screen arrangement so only the edges touch, but that's also rather wonky and the mouse leaves more often than not by accident.
Currently I'm running Ubuntu 20.04 with KDE Plasma 5.18.5
Perhaps you got some suggestions on how to create a script myself, I read about Pointer Barriers, though I have no idea if that would also end up just pulling back the mouse, e.g. allowing the input.
What I also saw is that you can't make the displays completely separate in the display arrangement, there is always a connection where the mouse can pass. Sadly I did not find a way to circumvent it.
Kind of weird that such a simple issue still does not have a fix, but perhaps I just overlooked it.