kmonad / kmonad

An advanced keyboard manager
MIT License
4.08k stars 322 forks source link

Misbehaving tap-hold style buttons in tap-macro and other tap-hold style buttons #872

Open jokesper opened 3 months ago

jokesper commented 3 months ago

The tap-hold style buttons only have a press action which adds a hook waiting for it's release. The problem is that said hook only work for keycodes. This is also a problem for the button in #859. There are multiple possible solutions:

  1. Change hooks to listen to button events instead of key events (possibly requires button ids or checking buttons for equality)
  2. Add extra release handler which cancels the hooks registered in the press part (requires unregistering or state)
  3. Think up a better solution to describe button which is more robust (a lot of work)
jokesper commented 3 months ago

Some parts of the code expect separate press and release actions (press-only, release-only, tap-macro, sub buttons in tap-hold style, ...) While others don't conform to this interface (tap-hold style buttons, around-only, around-when-alone, sticky-key). So in truth we have different kinds of buttons which are not distinguised. The perfect solution would probably be to implement some kind of type system and do type checking. A (hopefully) temporary solution could be adding an optional extra tap action which falls back (around when using the other variants, only the tap button in the tap-hold style).