Repository navigation
Focus an open app at once: wait for the keyboard handoff, not an unmap - #118
Merged
cpow merged 1 commit intoDec 1, 2026
Merged
Conversation
↵ on an app that already has a window took about a second to focus it. AppFocuser waited for the omacast layer to leave `hyprctl layers`, but since c4cb76c the surface stays mapped while hidden, so the wait always ran its full 20 × 50 ms. What it stood for is the keyboard: Hyprland refuses focus while the layer holds exclusive keyboard focus, and refocuses the window under the pointer when it lets go. The launcher's window turns inactive once Hyprland has moved the keyboard away, so the focus is queued until then and dispatched right after, with a 1 s timer for a handoff that never reports back. A launcher that takes the keyboard again drops a focus still queued from the last session. ↵ to focused: ~1060 ms -> 19-33 ms. SPEC §5.1 and CLAUDE.md now describe the mapped surface and the handoff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
↵ on an app that already has a window took about a second to focus it.
AppFocuserwaits for theomacastlayer to leavehyprctl layersbefore it dispatches focus, but since c4cb76c the surface stays mapped while hidden, so that wait always runs its full 20 × 50 ms.What the wait stood for is the keyboard handoff: Hyprland refuses focus while the layer holds exclusive keyboard focus, and refocuses the window under the pointer when it lets go. The launcher's window turns inactive (
Window.active) once Hyprland has moved the keyboard away, so the focus is now queued until then and dispatched right after. A 1 s timer, the old worst case, covers a handoff that never reports back. With the launcher hidden (omacast run app:…) it dispatches at once, and a launcher that takes the keyboard again drops a focus still queued from the last session.SPEC.md§5.1 said the surface is mapped fresh on every open, and theCLAUDE.mdnote on opening an open app said the focus waits for an unmap; both now describe the mapped surface and the handoff.Evidence
Omarchy 4.5.0, Hyprland 0.56.2, Quickshell 0.3.2, Qt 6.12.
The hidden launcher's layer is still listed, so the old loop never breaks:
shownandWindow.activelogged on the launcher aroundomacast show/omacast hide:A
hl.dsp.focusdispatched right afteractive=falseis accepted on the first try and stays.Time from ↵ to
hyprctl activewindowreporting the app (launcher mapped and focused first, query cleared with Ctrl+U), with focus checked again 0.6 s later:omacast run app:…with the launcher hidden 30, 31 ms. Focus held in every run.node --test tests/*.test.js: 187 pass, 0 fail, 3 skipped.omarchy plugin validate .passes.tests/smoke.sh: all ok, worst toggle 35 ms. An independent read-only review of the diff found no bugs; its one suggestion (drop a stale queued focus on reopen) is in.Merge Danger
Door: two-way
Reverting the commit restores the old wait.
Blast Radius: ↵ on an app that already has a window
Launching an app with no window, Shift+↵ and every other command take the same path as before. If the launcher's window never reports inactive, the focus fires after 1 s, as it did before this change.