KZDKM / Hyprspace

Workspace overview plugin for Hyprland
GNU General Public License v2.0
261 stars 8 forks source link

Add Basic Touch Support (?) #28

Open nine7nine opened 1 week ago

nine7nine commented 1 week ago

Hey @KZDKM

It would be nice if Hyprspace had basic touch support. Not necessarily anything fancy like gestures, but at least the ability to do the following:

  1. Touch a workspace and have have it selected / move to the workspace
  2. Touch/hold a window with autoDrag and have it move the window

Currently, it doesn't register any input from touch events (which Hyprland does support). IIRC, Hyprland also does support touch gestures, but at least for me: I already have a 3 finger multi-touch gesture for toggling Hyprspace + the expanders (dead-space) in my Panel/Topbar trigger toggling it too, with a mouse/Stylus click or touch event....

In any case, it would be awesome if Hyprspace handled basic touch events, as sometimes I do use my device as a tablet (even sometimes without using my stylus).

KZDKM commented 1 week ago

Yes, I forgot that touch input events have a separate protocol. This would be easy to fix, I just had to add touch event hooks and call the corresponding input function. Since the plugin hooks into swipe event, touch gestures could be fixed with hyprgrass as it emulates swipe event.

nine7nine commented 1 week ago

Yeah, I use hyprgrass for gestures / swipes -> but obviously that has nothing to do with actual point-click single touch, which is the more basic bit that needs to be handled in Hyprspace.

KZDKM commented 1 week ago

Sorry I'm bogged down with other stuff recently. See https://github.com/KZDKM/Hyprspace/commit/2203e5844167a73a8ea9cd7df41eaeed8c700df4.

This is untested as I do not have touchscreen to test it with right now. Please report whether if the implementation works.

nine7nine commented 1 week ago

no worries at all!

I'll give your commit a whirl, tonight -- when I am home.

nine7nine commented 1 week ago

So I tested this -- it doesn't appear to work. However, I am wondering if it may actually be an issue in Hyprland.

Hyprland handles touch in a funny way / non-parity with mouse/click events.

For example: If i have 2 floating windows in Hyprland

KZDKM commented 1 week ago

I just realized that the touch coordinate sent through the touch event should be scaled by monitor's size. The newest commit should fix it. However, a recent change was introduced in hyprland git that broke compatibility with older versions, so to test it you have to change to hyprland-git.

Hyprland handles touch in a funny way / non-parity with mouse/click events.

Indeed, however this is to be expected as any-half decent touch input system implementation should not simply emulate mouse clicks.

nine7nine commented 1 week ago

I'll give it a whirl and let you know... and yeah, no worries: I'm using hyprland-git / I'm aware of the registerCallbackDynamic() breaking API change.

Agreed, that it shoudn't emulate mouse clicks -- but at the same time, in the example I gave; hyprland clearly is actually doing the wrong thing. a touch event SHOULD affect the z order / bring the active window to the front.