Skip to content

Continue tracking hold shortcuts even when other keys are pressed during the hold - #14645

Merged
ryanrhughes merged 1 commit into
omacom:quattrofrom
nchudleigh:fix/push-to-talk-hold
Oct 9, 2026
Merged

ryanrhughes merged 1 commit into
omacom:quattrofrom
nchudleigh:fix/push-to-talk-hold

Conversation

@nchudleigh

@nchudleigh nchudleigh commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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::onKeyEvent calls shadowKeybinds() after every release, which shadows each bind whose key is still down, and handleKeybinds skips a shadowed bind. It also skips a release bind when the modifiers at release differ from the press. That is what makes bindr = SUPER, SUPER_L tap-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:

  • The release half is transparent (Hyprland never shadows it) and ignore_mods, so typing, clicking, or changing modifiers during the hold doesn't drop it.
  • The release half is also 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.
  • It runs only after its own press ran, so a key released without the rest of its chord (a plain x after SUPER + X) does nothing, and each press gets exactly one release.
  • It takes the same actions as o.bind (commands, dispatchers, functions, { launch = ... } tables) and registers commands in o.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 = true binds 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.sh covers each half's options, press/release pairing, and each action type. test/shell.d/dictation-test.sh now checks that F9 and Right Alt start on press and stop on release.
  • On real Hyprland 0.56.2 (virtual DRM device, virtual keyboard, a terminal recording the bytes it receives), with this branch's helpers.lua and dictation.lua loaded:
    • F9 and Right Alt each start and stop once for a plain hold, a hold with letters typed, and a hold with Shift pressed during it or still down at release.
    • Shift+F9 and Ctrl+F9 reach the app and start nothing. A plain x reaches the app with a SUPER + X hold bound. Plain F9 stays with dictation.
    • A SUPER + X hold releases once with a letter typed, and once with SUPER let go first.
    • Dispatcher, function, and command-string actions all run.
    • As a control, a plain release = true bind still loses its release when a letter is typed during the hold.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium impact] Refactors push-to-talk key binding to handle overlapping keypresses.

The PR still needs the reload fix before merging: releasing a held dictation key after a reload can leave recording running.

Findings

  1. P1 Reloads leave dictation running ▶

Summary

Adds o.bind_hold and uses it for F9 and Right Alt push-to-talk.

  • Pairs each release with a press that actually ran.
  • Makes releases survive other keys, clicks, and modifier changes.
  • Registers command actions for the keybindings menu and adds pairing tests.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Matching key press] --> B[Set held to true]
  B --> C[Run press action]
  D[Key release] --> E{held is true?}
  E -->|Yes| F[Set held to false]
  F --> G[Run release action]
  E -->|No| H[Do nothing]
Loading

Reviews (2) · Last reviewed commit: "Stop push-to-talk even when other keys a..." · Reviewed by Greptile

Comment thread default/hypr/helpers.lua
-- 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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>
@nchudleigh
nchudleigh force-pushed the fix/push-to-talk-hold branch from 1563d3f to f86651d Compare October 9, 2026 01:02
@nchudleigh nchudleigh changed the title Stop push-to-talk even when other keys are pressed during the hold Continue tracking hold shortcuts even when other keys are pressed during the hold Oct 9, 2026
@ryanrhughes
ryanrhughes merged commit 54fc12d into omacom:quattro Oct 9, 2026
1 check passed
@emirb emirb added this to the 4.5 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants