Stop push-to-talk even when other keys are pressed during the hold (#14645)
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: superduck00 <294879536+superduck00@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4 files changed
+143
-4
No files matched your search
@@ -219,12 +219,25 @@ o = {
|
||||
return configured
|
||||
end,
|
||||
bind = function(...) table.insert(bindings, {...}) end,
|
||||
bind_hold = function(keys, _, press, _, release, options)
|
||||
table.insert(bindings, { keys, press, options })
|
||||
table.insert(bindings, { keys, release, options })
|
||||
end,
|
||||
}
|
||||
dofile(root .. "/default/hypr/bindings/dictation.lua")
|
||||
assert(#bindings == 0, "unconfigured dictation leaves application keys available")
|
||||
configured = true
|
||||
dofile(root .. "/default/hypr/bindings/dictation.lua")
|
||||
assert(#bindings == 5, "any configured backend receives the same bindings")
|
||||
local function binds(keys, command)
|
||||
for _, binding in ipairs(bindings) do
|
||||
if binding[1] == keys and binding[2] == command then return true end
|
||||
end
|
||||
end
|
||||
for _, keys in ipairs({ "F9", "ALT + Alt_R" }) do
|
||||
assert(binds(keys, "omarchy-dictation start") and binds(keys, "omarchy-dictation stop"),
|
||||
keys .. " starts dictation on press and stops it on release")
|
||||
end
|
||||
LUA
|
||||
pass "dictation shortcuts require a selection without limiting backend names"
|
||||
|
||||
|
||||
Reference in new issue
Block a user