Repository navigation
Continue tracking hold shortcuts even when other keys are pressed during the hold - #14645
Conversation
|
| -- here is transparent and ignores modifiers, and runs only after its own press | ||
| -- did, so letting go of the key without the rest of the chord does nothing. | ||
| function o.bind_hold(keys, press_description, press, release_description, release, options) | ||
| local held = false |
There was a problem hiding this comment.
Reloads leave dictation running
o.bind_hold creates fresh callbacks with held = false whenever the config loads. If a theme change reloads Hyprland while F9 or Right Alt is held, the new release callback skips omarchy-dictation stop. Recording then continues after the key comes up. Keep the pending hold across reloads, or end it before replacing the callbacks.
Hyprland skips a release bind once any other key or mouse button is released while its key is held (KeybindManager::shadowKeybinds), and when the modifiers changed since the press. That is what makes a bind like "bindr = SUPER, SUPER_L" tap-only, but it means typing or clicking while holding F9 or Right Alt never runs omarchy-dictation stop, so the recording keeps going. o.bind_hold binds a press and a release action together. The release half is transparent (it can't be shadowed), ignores modifiers, and is non-consuming, so it doesn't take the key from apps when pressed with other modifiers (Shift+F9 still reaches the app). It runs only after its own press ran, so releasing the key without the rest of a chord does nothing. Dictation's push-to-talk keys use it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1563d3f to
f86651d
Compare
Holding F9 or Right Alt to dictate and typing a letter or clicking during the hold leaves the recording running after the key comes up.
Hyprland skips a release bind once any other key or mouse button is released while its key is held:
KeybindManager::onKeyEventcallsshadowKeybinds()after every release, which shadows each bind whose key is still down, andhandleKeybindsskips a shadowed bind. It also skips a release bind when the modifiers at release differ from the press. That is what makesbindr = SUPER, SUPER_Ltap-only, but any press/release pair on Omarchy, such as push-to-talk, loses its release this way.This adds
o.bind_hold(keys, press_description, press, release_description, release, options), which binds both halves together:transparent(Hyprland never shadows it) andignore_mods, so typing, clicking, or changing modifiers during the hold doesn't drop it.non_consuming. A release bind that ignores modifiers otherwise takes its key from apps whenever it's pressed, so Shift+F9 or Ctrl+F9 would stop reaching apps.xafterSUPER + X) does nothing, and each press gets exactly one release.o.bind(commands, dispatchers, functions,{ launch = ... }tables) and registers commands ino.bind_commands, so the keybindings menu still lists and runs both halves. Options that change when a bind fires (repeating,long_press,click,drag) apply to the press half only.Dictation's F9 and Right Alt push-to-talk use it. Plain
release = truebinds are left alone, since tap-only binds rely on the shadowing.One limit: reloading the config while the key is held resets the pairing, so that one release does nothing.
Testing
test/shell.d/bind-hold-test.shcovers each half's options, press/release pairing, and each action type.test/shell.d/dictation-test.shnow checks that F9 and Right Alt start on press and stop on release.helpers.luaanddictation.lualoaded:xreaches the app with aSUPER + Xhold bound. Plain F9 stays with dictation.SUPER + Xhold releases once with a letter typed, and once with SUPER let go first.release = truebind still loses its release when a letter is typed during the hold.🤖 Generated with Claude Code