Bug 451744 - Implement toggle for "Sticky corners", preventing mouse cursor moving between monitors in corners
Summary: Implement toggle for "Sticky corners", preventing mouse cursor moving between...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: fanzhuyifan
URL:
Keywords: usability
: 474842 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-03-20 22:20 UTC by A. R. Kristiansen
Modified: 2024-03-09 00:53 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1 (Wayland-only)


Attachments
An example image showing a mouse cursor moving into a corner, and its trajectory sliding onto the adjacent monitor. An example of a 25px threshold is also drawn on top (687.79 KB, image/png)
2022-03-20 22:20 UTC, A. R. Kristiansen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description A. R. Kristiansen 2022-03-20 22:20:05 UTC
Created attachment 147636 [details]
An example image showing a mouse cursor moving into a corner, and its trajectory sliding onto the adjacent monitor. An example of a 25px threshold is also drawn on top

SUMMARY
To aid with button interactions in monitor corners, the four corners of a monitor should (optionally) stop quick mouse movements towards corners from moving onto the adjacent monitor.

HOW THIS IS USEFUL TO USERS
An example for a user with the close button in the top left of an application: They quickly move their cursor to the top left, to close a maximized application. However due to the quick movement, the cursor slides onto the left-adjacent monitor.

Plasma stopping the mouse cursor from doing this in corners would be a great quality-of-life improvement for users with many monitors, who tend to maximize applications on several monitors. This is only an example, there are more benefits to this.

Another use case I can imagine this is extremely helpful for, is to aid hot corner usage for window tiling.

Let me use a final, personal example: I have a hotkey bound to Spectacle rectangle selection, to copy a screenshot to clipboard quickly. Sometimes I want to capture screenshots beginning in a screen edge, with these "sticky" corners, worrying about capturing pieces of adjacent monitors (or manually editing these tiny details) is no longer needed. 

It would also be nice if this could have a configurable threshold. Let's say by default, on a 1080p monitor, it stops your mouse cursor if it tries to move to the other screen 20~25 pixels within the top or bottom of the screen. A slider can let users define this threshold themselves.

The feature is most likely best for power users. So at your own discretion, would best be implemented as an optional feature, disabled by default to avoid confusion for existing Plasma users if anything.

STEPS TO REPRODUCE
1. With a multi-monitor setup, move the mouse cursor all the way down or up into a corner that has another monitor next to it
2. Move the mouse cursor towards the other monitor

OBSERVED RESULT
The mouse cursor moves freely to the other monitor with no resistance

EXPECTED RESULT
Plasma should ideally stops the mouse cursor from moving onto the other monitor

SOFTWARE/OS VERSIONS
Linux: Linux 5.16 ("Zen")
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
An implementation of this feature can be observed in action with Windows 8 or newer.
In case my explanation is not clear, I have attached an image which should hopefully clarify.

Apologies if this is the wrong category to post this wish in. Thank you for reading!
Comment 1 ratijas 2022-03-22 21:32:50 UTC
Moving to KWin. Not sure about the component, but it's definitely closer.

Can confirm. Lately I'm working on Windows machine as a primary desktop, and gotta admit: it has this nice feature of _sometimes_ magically stopping the cursor from moving to the other screen. Often it triggers unpredictably or when not needed at all, but that's just a matter of heuristics which can and should be improved.
Comment 2 A. R. Kristiansen 2022-03-23 09:42:46 UTC
(In reply to ratijas from comment #1)
>Moving to KWin. Not sure about the component, but it's definitely closer.

Thanks a lot!

>it has this nice feature of _sometimes_ magically stopping the cursor from moving to the other screen. Often it triggers unpredictably or when not needed at all, but that's just a matter of heuristics which can and should be improved.

Glad I'm not alone 😁 I agree, it can and should definitely be improved upon and not carbon copied. I found that Windows stops your cursor completely in corners about... 2-ish percent of the screen up and downwards depending on the corner location. I think this is perfect, but it should be configurable.
It also stops your mouse on **any** edge if you're dragging a window; UNLESS your cursor is traveling at a certain speed. This can be a blessing and a curse.. Again, also how it can be improved upon. I like the function, but wish I could tune the velocity threshold when I do have no option but to use Windows. Others will definitely want to disable it.
Comment 3 Nate Graham 2023-09-25 18:42:41 UTC
*** Bug 474842 has been marked as a duplicate of this bug. ***
Comment 4 fanzhuyifan 2024-02-19 03:12:55 UTC
See also: https://invent.kde.org/plasma/kwin/-/merge_requests/3801
Comment 5 fanzhuyifan 2024-02-19 03:27:50 UTC
I'll take a look at this after the MR about sticky edges gets sorted out.
Comment 6 fanzhuyifan 2024-03-08 20:54:39 UTC
Git commit ad13765348403122747b02e7c26539b55a624dd5 by Yifan Zhu.
Committed on 08/03/2024 at 20:03.
Pushed by fanzhuyifan into branch 'master'.

pointer_input: implement edge barrier between screens

Allow users to configure a virtual edge barrier between screens.
The pointer will only cross over to the other screen after the distance
travelled surpasses edgeBarrier.

Reduce the speed during interactive moveresize, at edges that trigger,
and at the corner.

Only supports wayland. Doesn't have X11 support since it is far too
complicated there.
Related: bug 416570

M  +4    -0    autotests/integration/kwin_wayland_test.cpp
M  +89   -0    autotests/integration/pointer_input.cpp
M  +4    -0    autotests/integration/screens_test.cpp
M  +10   -0    src/kcms/screenedges/kwinscreenedgesettings.kcfg
M  +55   -0    src/kcms/screenedges/main.ui
M  +10   -0    src/kwin.kcfg
M  +22   -0    src/options.cpp
M  +30   -0    src/options.h
M  +83   -2    src/pointer_input.cpp
M  +15   -1    src/pointer_input.h
M  +10   -0    src/screenedge.cpp
M  +4    -0    src/screenedge.h

https://invent.kde.org/plasma/kwin/-/commit/ad13765348403122747b02e7c26539b55a624dd5
Comment 7 fanzhuyifan 2024-03-08 20:56:48 UTC
Since this is very difficult to implement on X11, and given that kwin X11 is feature frozen and the default session type is now wayland, we won't be supporting this on X11.
Comment 8 A. R. Kristiansen 2024-03-08 21:49:15 UTC
(In reply to fanzhuyifan from comment #7)

Perfect, thank you SO very much! Can't wait to give this a try.