Plugin API: expose starting key in swipe gestures #22
Hi, I’d like to suggest extending the plugin gesture API.
Currently plugins can handle swipes with:
def on_swipe(direction, state):
But the callback only provides the direction, so plugins cannot know which key the swipe started from.
It would be much more useful if the API also provided the starting key:
def on_swipe(key, direction, state):
For example:
def on_swipe(key, direction, state):
if key == "space":
if direction == "left":
# custom action
pass
elif direction == "right":
# custom action
pass
elif direction == "up":
# custom action
pass
elif direction == "down":
# custom action
pass
elif key == "backspace" and direction == "left":
delete_word()
return state
Ideally, directions could include:
left
right
up
down
up_left
up_right
down_left
down_right
This would enable mappings such as:
Space ↑ → clipboard / custom action
Space ↓ → voice input
Space ← → switch language
Space → → emoji
Backspace ← → delete word
Enter ↑ → custom command
A ↑ → custom action
If gesture coordinates are already available internally, an extended version could also be supported:
def on_swipe(key, direction, start_x, start_y, end_x, end_y, state):
However, key + direction alone would already cover most use cases.
It would also be useful if swipe gestures could trigger existing Clink commands or Automation actions, for example:
if key == "space" and direction == "left":
run_action("my_custom_action")
This would effectively turn each key into a small gesture surface without adding extra UI buttons.
The space bar in particular could provide several useful shortcuts while keeping the keyboard clean, and plugins could implement their own gesture mappings instead of requiring every gesture to be built directly into Clink.
Thanks for considering it.
Reported from Discord ideas thread Plugin API: expose starting key in swipe gestures
Posted by 奥寺美纪 · @5981185a5439 · 325610229154840576