swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.71k stars 1.11k forks source link

More advanced touchpad gestures #7766

Open emilyyyylime opened 1 year ago

emilyyyylime commented 1 year ago

I propose two new touchpad gesture types: tap and scroll

Tap

Tap would operate similarly to hold, however, it would recognise short taps, rather than long presses on the touchpad. Even better could be adding parameters for hold that allow controlling the range of milliseconds the hold will need to be to be successfully recognised — this opens up the question of how to specify such a range, two options I think could be accessible are exposing a specific set of periods such as short, medium, long and specifying a range of milliseconds (either just min or min-max); these options are, of course, not mutually exclusive. Another question is where would you put such an argument; I can think of putting it in place of the direction setting, seeing as hold can't take a direction either way, or as a command-like parameter --period — which then further opens up the question of what it does when combined with the other gesture types. For that reason I believe the former is preferable.

Even if implemented using input ranges, I think tap should be available as an alias for a short hold (0-500ms?)

An example use case is play/pause control with a 4-finger tap as bindgesture tap:4 exec playerctl play-pause or bindgesture hold:4:very-short exec playerctl play-pause

Scroll

Scroll would operate similarly to swipe, however, rather than being discrete in its triggering, it would allow continuous triggering of the action, similarly to how scrolling with the touchpad continuously (rapidly) moves the screen.

This should probably come with a scroll factor of its own, which will be combined with the device-specific scroll factor. This again could either be yet another colon-separated value, or a cli-like argument --factor. I don't know which is preferable here.

An example use case is volume control with 3-finger vertical scorlling:

bindgesture scroll:3:up   exec volumectl +1%
bindgesture scroll:3:down exec volumectl -1%
clushie commented 8 months ago

https://github.com/bulletmark/libinput-gestures

You can use libinput-gestures for that functionality.

It can also be combined with swaymsg.

~/.config/libinput-gestures.conf

gesture swipe up volumectl +1%
gesture swipe down volumectl -1%
gesture swipe left swaymsg workspace prev
gesture swipe right swaymsg workspace next
emilyyyylime commented 8 months ago

@clushie I can't see how libinput-gestures does anything different than bindgesture here.