Open matt1432 opened 1 week ago
that's genius! I had the idea of using dispatchers to do somewhat the same thing but it was too clunky to use and so I dropped it.
I think rather than hooking on to the "opposite of workspace gesture" it's easier to provide hooks for a generic "swipe" event (and same for "edge" and others).
for that you can emit the events in handleDragGesture()
and handleDragGestureEnd()
. A drag basically means the gesture has a clear "start" and "end" point - when a "swipe" is first recognized, handleDragGesture() is called. when the gesture ends, e.g. lifted a finger, handleDragGestureEnd() is called.
not so important to the problem at hand, if handleDragGesture did not do anything (returns false), handleCompletedGesture()
will be called in place of the usual "end" event.
I'd like to see some way for hook users to tell us if they did anything: if they handled the gesture, we need to block touch events from going to the app window (among other things). for this, EMIT_CANCELLABLE_EVENT might be useful
So I try having handleDragGesture()
, handleDragGestureEnd()
and dragGestureUpdate()
emit the event but it seems like the workspace swipe takes ownership of any 3 finger swipes if that makes sense.
I try to swipe vertically instead to not trigger the workspace swipe but that does not emit anything during that gesture.
can you push what you have now?
It's not much but here you go
Crashes Hyprland as soon as I do a gesture :(
No crash report in ~/.cache/hyprland
added some checks, so that workspace swipe doesn't crash
notification now works, but idk what the API should look like yet. i think at the very least we'll need 3 separate hook events for start/update/end and possibly more for each gesture type
edit: also the events should be namespaced under hypgrass:
or something
i think at the very least we'll need 3 separate hook events for start/update/end and possibly more for each gesture type
Yes I was thinking that too.
the events should be namespaced under hypgrass: or something
Yes I agree
I tried your latest commit and it did work to emit changes for swipes, but the workspace swiping wasn't working, is that normal?
yea right now the hook just "consumes" the drag event unconditionally
@horriblename I finally figured out how to make the hooks compatible with hyprexpo's gesture, which was my original goal.
I had to stick with IPointer::SSwipeUpdateEvent
instead of using ITouch::SMotionEvent
like you said because it doesn't hold any info on the amount of fingers, and I feel like exposing a delta is better than the position when it comes to a gesture.
What do you think?
Also, should I be using EMIT_HOOK_EVENT_CANCELLABLE
instead of EMIT_HOOK_EVENT
?
Also, should I be using EMIT_HOOK_EVENT_CANCELLABLE instead of EMIT_HOOK_EVENT?
EMIT_HOOK_EVENT is fine. Only the start event needs to check that an event is handled
I had to stick with IPointer::SSwipeUpdateEvent instead of using ITouch::SMotionEvent like you said because it doesn't hold any info on the amount of fingers
uuh I'll mull it over, but I think if we're exposing a hook API I'd like it to be extensible as possible
I am trying to make it possible for another plugin to hook onto the opposite gesture of the workspace gesture.
I had the idea of copying hyprexpo's touchpad gesture on a touchscreen by having hyprgrass emit a hook when dragging the opposite way and then have hyprexpo hook onto it.
I have the hook and listen thing figured out, but the gesture part is very unclear to me.
I can't really tell how to listen to a gesture or even if one is recognized at all. Would love to get some info on that.
Thanks!