elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
9.11k stars 376 forks source link

[FEATURE] doubleclick event on `eventbox` and `button` #450

Open Vermoot opened 2 years ago

Vermoot commented 2 years ago

Description of the requested feature

With the addition of click, right click, and middleclick events on eventbox elements, I found myself thinking it'd be nice to have a way to catch double clicks as well.

Proposed configuration syntax

(eventbox :doubleclick "notify-send 'you have doubleclicked'")

Additional context

No response

elkowar commented 2 years ago

Do we wanna have :doubleclick :doublemiddleclick :doublerightclick ? Also, I fear that it might be annoying w.r.t. it also sending the single-click before that -- as far as I'm aware, gtk is somewhat dumb in that regard (although I haven't tested extensively)

elkowar commented 2 years ago

Maybe one possible api would be having the click handlers take an event argument with the how-manyth click it was i.e.

:onclick "if ['{0}' -eq 2]; then doubleclick_thing; else singleclick_thing; fi"
Vermoot commented 2 years ago

I think a double click is a common enough action to warrant having its own property in the button and eventbox widgets. Double right click and double middle click, while interesting and underused are not very common and probably wouldn't get much use.

Idk how gtk would handle doubleclick, but I'm hoping it's smart enough to check the system's double click delay and waits that delay before deciding if an action is a single or a double click. After all, double clicks in GTK apps is probably a common enough occurrence to be handled correctly. You'd hope so, at least.