Bug 402857

Summary: Touchpad gestures should be configurable
Product: [Plasma] kwin Reporter: Vlad Zahorodnii <vlad.zahorodnii>
Component: GesturesAssignee: KWin default assignee <kwin-bugs-null>
Status: CONFIRMED ---    
Severity: wishlist CC: 3030994569, aadeshkanna28022000, adressepoub.rl, alex765, alias_showing363, amyekut, bojidar.marinov.bg, breakingspell, bugs.kde.org, bugseforuns, cfeller, chermnykh2001, chwshka, computer11whiz, dikey0ficial, dmatteo002, frans-jan, g311571057, hexclover, imasuffix, imperialfenceuser, j5lx, jandominiksonnenwald, kdebugs, kitt997, m.kurz, mabo, matasniewulis2001, mattia.b89, miranda, morisset.hugues, nate, noahdcraig, nugb0, nullzert.null, openmindead, oshiorns1+kdebugs, pinage404, rom1dep, surlaget, sylvain.saboua, thomaslukeduffin, torricolas, typingcat, ustaliufuk73, whyhow+tech, ydz
Priority: VHI Keywords: wayland
Version: git master   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=462935
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Vlad Zahorodnii 2019-01-04 14:49:51 UTC
SUMMARY
Users should be able to configure existing gestures, for example change the number of fingers, or just disable some gestures.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.14.80
KDE Frameworks Version: 55.53
Qt Version: 5.12
Comment 1 Martin Flöser 2019-01-05 10:14:00 UTC
My personal preference would be to integrate into KGlobalAccel. Also mouse shortcuts, etc.
Comment 2 Nicolas Fella 2021-01-09 16:22:34 UTC
*** Bug 431356 has been marked as a duplicate of this bug. ***
Comment 3 Nicolas Fella 2022-08-24 13:27:10 UTC
*** Bug 458237 has been marked as a duplicate of this bug. ***
Comment 4 Petrov Egor 2023-03-13 13:25:47 UTC
Sadly that in the most configurable DE touchpad gestures couldn'be customized;(
Comment 5 David 2023-03-13 21:41:41 UTC
(In reply to Petrov Egor from comment #4)
> Sadly that in the most configurable DE touchpad gestures couldn'be
> customized;(

I cannot help it but agree on this one.
Comment 6 Zamundaaa 2023-06-12 15:53:40 UTC
*** Bug 443022 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2024-03-01 06:29:51 UTC
*** Bug 482030 has been marked as a duplicate of this bug. ***
Comment 8 Blazer Silving 2024-03-07 02:51:34 UTC
With the Plasma 6 dust settling, this is a part I feel needs priority for laptop-heavy use. My use case is using three-finger navigation to move between virtual desktops+grid, and four fingers for brightness+volume control (all through touchegg formerly). 

My touchegg config ported right over to libinput-gestures for Wayland, but the native gestures continue to move between desktops when libinput-gestures are activated. Is it feasible to implement a toggle for the hardcoded 3-4 finger desktop switching, so users can substitute their own gesture handlers in the interim? 

It may warrant an extra bug report as well, but the native gestures are VERY sensitive. Compared with a Macbook's three-finger gestures that smoothly transition between virtual desktops (with intertia), the current Wayland gestures are too fast unless you only move your fingers a few millimeters, and then there's still no smooth inertia as you let go.
Comment 9 Hugues Morisset 2024-03-09 12:03:32 UTC
I want 3 fingers gestures for grid aswell, until there is a configuration switch, as a workaround I successfully patched the kwin_wayland binary to change 4 fingers to 3 fingers. I describes the steps here https://blog.izissise.net/posts/kwin-gesture-patch/
Comment 10 Seth 2024-04-03 04:37:11 UTC
sorry to pile on, really like KDE Plasma. the trackpad gestures just aren't configurable. i don't mind the 4 finger swiping, but 4 finger swiping down to pull up an overview isn't intuitive. the way Apply implements it is intuitive, in my opinion, anyway. 3 fingers swiping up gets you the overview, then 3 finger swipe back down returns to normal view. 3 fingers left or right moves desktops. the number of fingers isn't the issue, really (although 3 would be nice), it's the direction of the swipes. but just to have them freely configurable would be the best outcome. thanks for all the work y'all do!
Comment 11 Ima S 2024-04-09 19:39:10 UTC
I'd like to echo @breakingspell's comment for the plasma 6 upgrade. This is a serious issue for my laptop usage, I use my own custom gestures for almost all navigation (via libinput-gestures), and the current system breaks my entire config.

Please add an off button in settings. I don't care about extensibility in the short term, power users can manage their own gestures with other tools for now, but only once we can turn off the current system.

Even if other work is pending, at least add an on/off toggle in 'Settings -> Mouse & Touchpad -> Touchpad' for the next release.
Comment 12 Ima S 2024-04-09 22:39:10 UTC
I looked at the source, and the gesture seems to be registered by these lines:

https://invent.kde.org/plasma/kwin/-/blob/master/src/virtualdesktops.cpp#L772

If someone could wrap them with an if-statement that checks a toggle, that might be enough? I don't know how to contribute this myself or I would.
Comment 13 Blazer Silving 2024-04-10 01:13:54 UTC
(In reply to Ima S from comment #12)
> I looked at the source, and the gesture seems to be registered by these
> lines:
> 
> https://invent.kde.org/plasma/kwin/-/blob/master/src/virtualdesktops.cpp#L772
> 
> If someone could wrap them with an if-statement that checks a toggle, that
> might be enough? I don't know how to contribute this myself or I would.

Thanks for scoping out where these are! I was looking in the entirely wrong place (src/gestures.cpp) before giving up last month and falling back to X11 for a few other reasons. 

Did a quick test by just commenting out the hardcoded instances of registerTouchpadSwipeShortcut() in virtualdesktops.cpp, it does prevent the gestures from triggering. To note, the 4-finger up-down gestures are defined in overvieweffect.cpp as addTouchpadSwipeGesture(): 
https://invent.kde.org/plasma/kwin/-/blob/master/src/plugins/overview/overvieweffect.cpp#L36

Putting the registers behind a config toggle or dummying out doesn't seem like the right solution even for short-term though. The code is spread out among multiple components so it will need to be unified at some point, it'd be worse later on if they're just patched out here. Would it be possible to bring all these Touchpad registers into gestures.cpp, and then configure from there?
Comment 14 Zamundaaa 2024-06-07 20:17:41 UTC
*** Bug 454231 has been marked as a duplicate of this bug. ***
Comment 15 Nate Graham 2024-06-12 19:21:16 UTC
*** Bug 487710 has been marked as a duplicate of this bug. ***
Comment 16 Zamundaaa 2024-07-11 14:53:04 UTC
*** Bug 490067 has been marked as a duplicate of this bug. ***
Comment 17 cwo 2024-08-07 23:38:30 UTC
*** Bug 491409 has been marked as a duplicate of this bug. ***
Comment 18 Sin Jeong-hun 2024-09-16 10:01:21 UTC
Even Windows natively allows customising gestures.  Under Windows, I used to use "three-finger left/right swipe" for "go backward/forward", basically the same as the mouse back/forward buttons. In my opinion, this was really helpful, because I could easily/quickly browser the web, file manager, and even programming IDE's. Gnome does not provide gesture customisation either, but at least there was an extension that allowed me to map "three-finger left/right" to "go forward/backward".

Currently, on Plasma, both three and four-finger swipes do the same thing: switching desktop, and I have to move the mouse pointer to click the back icon on the top-left of the app. Really inconvenient and hurting my wrist. If not full customisation, I wish at least there was some sort of checkbox to use three-finger swipes for "go forward/backward".
Comment 19 Amnon 2024-10-28 21:37:53 UTC
I got to this bug because the 3 finger switch between screens seems reversed to me. Awkward to use it. 
Please implement a convenient way to select direction (and even better -- a menu for choice of function) of 3 finger horizontal touchpad swipe!.
Comment 20 Ben 2024-11-08 03:57:33 UTC
Please consider looking into this issue, very awkward for laptop users coming from other OSes (or those coming from DEs that actually allow gesture configuration)
Comment 21 Filip 2024-11-08 19:21:35 UTC
*** Bug 495984 has been marked as a duplicate of this bug. ***
Comment 22 Nate Graham 2024-11-08 21:57:18 UTC
*** Bug 494227 has been marked as a duplicate of this bug. ***
Comment 23 chwshka 2024-12-02 21:30:18 UTC
This really should be a high priority. Losing this functionality from x11 > wayland is a step back and really makes KDE feel clunky on a laptop vs Windows/Mac and various other Linux distros. Just the ability to switch windows with 3 finger gestures would be a big step.
Comment 24 Blazer Silving 2024-12-03 02:42:40 UTC
Is there an effort already in motion to work on this, beyond https://invent.kde.org/plasma/kwin/-/issues/59?
Let's break it down and try to shake the dust off. From what I gather, user-configurable touchpad gestures in Wayland need: 

1. A defined list of supported gesture actions (i.e. Next/Previous Desktop, Window Management, Raise/Lower Volume/Brightness, custom invocations, etc). This also should include an option to disable handling of each gesture individually, to allow for libinput-gestures and other external applications to step in.

2. Integration in Kwin (or kglobalacceld now?) to map and register these defined actions to gestures. 
This is much easier said than done, as it is currently hardcoded and spread out in several places, as we found earlier in this thread. 
A new unified gesture handler may be necessary? 

3. Lastly, a UX for the frontend KCM/System Settings to drive the mapping. I wouldn't say copy the competition, very similar can be done within Plasma's existing styling.
Comment 25 chwshka 2024-12-04 18:33:32 UTC
(In reply to Blazer Silving from comment #24)
> Is there an effort already in motion to work on this, beyond
> https://invent.kde.org/plasma/kwin/-/issues/59?
> Let's break it down and try to shake the dust off. From what I gather,
> user-configurable touchpad gestures in Wayland need: 
> 
> 1. A defined list of supported gesture actions (i.e. Next/Previous Desktop,
> Window Management, Raise/Lower Volume/Brightness, custom invocations, etc).
> This also should include an option to disable handling of each gesture
> individually, to allow for libinput-gestures and other external applications
> to step in.
> 
> 2. Integration in Kwin (or kglobalacceld now?) to map and register these
> defined actions to gestures. 
> This is much easier said than done, as it is currently hardcoded and spread
> out in several places, as we found earlier in this thread. 
> A new unified gesture handler may be necessary? 
> 
> 3. Lastly, a UX for the frontend KCM/System Settings to drive the mapping. I
> wouldn't say copy the competition, very similar can be done within Plasma's
> existing styling.

These are the gestures and actions available in touchegg and seem to cover almost everything that someone could want from this feature.

Gestures:
1) Swipe 3 fingers (vertical/horizontal)
2) Swipe 4 Fingers (vertical/horizontal)
3) Pinch
4) Tap

Actions:
1) Maximize or restore a window
2) Minimize a window
3) Tile/snap a window
4) Fullscreen a window
5) Close a window
6) Switch desktops/workspaces (or enter overview)
7) Show desktop
8) Keyboard shortcut
9) Execute a command
10) Mouse click
Comment 26 chwshka 2024-12-04 18:34:46 UTC
Just for reference: https://github.com/JoseExposito/touchegg

Currently only works on x11. There is a beta version that is semi functional on wayland.
Comment 27 surlaget 2024-12-04 19:20:54 UTC
There is also libinput-gestures. The problem is that the KDE gestures are hard-coded, so if you try to use your own gestures it will activate both from the same input.
Comment 28 Blazer Silving 2024-12-04 19:50:47 UTC
> These are the gestures and actions available in touchegg and seem to cover almost everything that someone could want from this feature.

Thanks for getting this list together. The last discussion thread on that Invent issue link regarding the list of actions and user control over them was over two years ago, so a new comment with this concise goal and information are the next step. 

Also I must remark: Touchegg currently covers everything I need in X11 and more, with libinput-gestures compatible for Wayland. I specifically use four-finger swipe for Volume+Brightness control with "repeat" frequency set so I can raise it from 0-100 with a single swipe across the pad, 50% with half, etc. 
This likely won't be a granularity offered by Plasma in their implementation, so I must emphasize the ability to disable the native gestures and allow a third party to act, even after the native system is regarded as polished and feature-complete