Gesture => shortcut or command: feasability on Wayland?

Hi there,

As many of you, I am also reconsidering the switch to Wayland for the upcoming Plasma 6 release.
I appreciate the work done on touchpad gestures, especially after having spent a decade on a macbook. Linux has in fact worsened my hook to gestures when I have discovered touchegg+touché (X11 session) for full customizability.

I don’t mind adopting the native Plasma gestures, my question is about importing a special one I love on top of them: (4-finger) pinch in to close a window (and out to turn the screen off).

From what I can read, global gestures (as global shortcuts apparently) would be very difficult to implement in Wayland as each app should implement them.

I gave it a try: in a Wayland session (Plasma 5.27 and 6), most of my custom gestures work, except that Plasma’s gestures are also triggered (clash = double action). The pinch to close, however, works only in non-KDE apps (through XWayland?).

I would appreciate any insight into this blurry topic! Things to try, where to look, etc.

Thanks!

1 Like

I know the kde folks say they plan to implement customizable trackpad gestures. Touchegg only works on x11 right? Perhaps that is the reason why it is only affecting xwayland apps?

Edit: found this on touchegg’s github repo

Edit 2: Found an open MR regarding tracking Plasma’s direction for touchpad and touchscreen gestures

1 Like

Their left to right gestures are backwards from gnome and I had asked if it were possible for me to change them. The answer I got was no → BUT admittedly that was a number of months or maybe even a year ago. It may have changed. But it does not sound like gesture customizability will likely be available yet (ever? If someone smart enough wants it, it probably will).

The problem is, you’ll be stuck with their opinionated implementation.

Wayland makes it impossible for third party programs to do this. Only the compositor can do it, simply because it ignores to follow the strict Wayland protocol.

Everyone should get used to that, as Wayland gets more and more adoption.

But. . . why can’t they be the same as GNOME at least?!? ugh.

Options. Pfff. You don’t need that non-sense.

If Wayland was designed my sane people, you could have gestures handled by a separate program from the compositor. But given the fact that it is not, you are vendor-locked. It’s the same reason I can’t have Xeyes on Wayland.

1 Like

Oddly enough, GNOME’s wayland gestures were the reason I left plasma. It completely changed my laptop workflow.

Flip side if it’s only wayland. . . then the gestures would be the same, but since they are reversed it must be a plasma setting somewhere. Side note I haven’t tried them on 6 yet, but in 5 wayland they were reversed.

Wayland is just a protocol. It is up to each compositor to implement the entirety of it.

X has a display server, and compositors for X are really simple. Wayland compositors are very complicated because they have to implement everything, including gestures. So you have what your compositor supports.

If my compositor supported animated eyes that follow the mouse cursor, I could have that under Wayland. But I can’t have a third party program like Xeyes doing that, just like you can’t have a third party program handling your gestures. You’re stuck with the implementation your DE gives you, there is no modularity, and there never will be, by design.

That was my hope, to stick in some DIY hack to add one functionality. It seems that it won’t be that easy.

It probably will be eventually. This is obviously just the beginning of a long new road.

But for now. . . ya. You got a big plate of “you get what you get.”

I’ve implemented on my own a universal one config with fusuma + ydotool.

I’ve looked at the libinput debug, it’s by default has a recognition of different kinds of swipes, pinches and etc. So it’s not that hard to make something even simpler just based on it.

I got a step closer thanks to this post and using the dotool package instead of ydotool in combination with fusuma (touché seems to work as well).

After several tests, here is what worked for me:

  1. Install dotool from AUR

  2. Activate it following the two command indicated in man dotool and test the different commands, such as --listkeys, try in the terminal echo key alt+F4 | dotool to see if it works.

  3. Install rubygems, and fusuma with gem install fusuma
    WARNING: no use of sudo, nor of the fusuma package in AUR!

  4. Add the path to fusuma binary to $PATH in .bashrc, as recommended when installing fusuma.

  5. Add this same path to autostarted apps in settings (ticking the “launch from terminal” option).

  6. Add your custom commands to fusuma’s config file (find it with fd --hidden config.yml), and reboot. For instance:

pinch:
  2:
    in:
      command: 'echo key ctrl+minus | dotool'
    out:
      command: 'echo key ctrl+plus | dotool'
  3:
    in:
      command: 'echo key super+pagedown | dotool'
    out:
      command: 'echo key super+pageup | dotool'
  4:
    in:
      command: 'echo key alt+f4 | dotool'
    out:
      command: "/bin/sleep 1 && /bin/dbus-send --session --print-reply --dest=org.kde.kglobalaccel  /component/org_kde_powerdevil org.kde.kglobalaccel.Component.invokeShortcut string:'Turn Off Screen'"

Alternative with touché:

  1. Install the AUR package touché, customize through the GUI, and use a dotool command if it does not work well in a Wayland session.

  2. activate touchegg service before rebooting:

sudo systemctl enable touchegg.service
sudo systemctl start touchegg

Caveat: touchegg is not supposed to work in a Wayland session, and I notice that it crashes after a few hours.

The only missing part for a full customisability would be to properly override Plasma’s gestures, instead of just clashing with them (both are executed). I guess we need to wait this Plasma feature is implemented.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.