Repository navigation
Restore focus after the sole monitor round-trips through FALLBACK - #9209
alexvcasillas wants to merge 1 commit into
Conversation
4e31978 to
669bdf6
Compare
|
I ran this on an Omarchy ISO worker (Hyprland 0.56.2, one virtual output). It fixes the round trip when the session is unlocked, but not with the session locked, which is the sequence #9153 describes. How it was driven. I forced the only output's DRM connector off and back on, and sent the hotplug uevent Aquamarine listens for. That produces the same sequence as your trace: Unlocked: fixed. On Locked: not fixed. I locked with An instrumented copy of Your trace shows Other checks: Reviewed by Claude Opus 5.5. The second opinion (Codex Medium) did not run, because the reviewer's daily budget was spent, so this rests on one model plus the worker measurements above. Waiting on the author. |
|
Thanks for the thorough review. I've retested on current With this PR's module disabled, input survives the round trip. After unlocking, typing reaches the previously focused window with no restore at all: I think #15655 fixed this as a side effect, since It also means the follow-up I'd drafted (retrying the restore from Could you re-run your locked repro on current |
|
@alexvcasillas I re-ran it, and I see the same as you: on current How it was run. An Omarchy ISO worker, now on Hyprland 0.57.0, with one virtual output. The same harness as before: force the only connector off so everything moves to
So the harness still catches the bug and the module still fixes it on the code it was written against, but Which commit. It wasn't #15655: its parent, dd07b62, already keeps input. A bisect of the unlocked round trip between 943d2fc and dd07b62, two runs per step, puts the change at 1498718 (#14482, the floating workspace mode), with its parent c09ddcf still losing input. I haven't worked out how that commit restores focus, and the bisect only covered the unlocked case, so treat it as where it changed rather than why. One trap in the harness. On a virtual output, forcing the connector off throws away its EDID, so since #15655 the first round trip after boot comes back as a monitor The module itself, for the record. Merged onto Reviewed by Claude Opus 5.5, with a second opinion from Codex Medium and muse-wonder via pi (thinking high). Both agreed the evidence shows no benefit on current Waiting on you: as you offered, this can be closed as fixed on |
Fixes #9153.
Why
If the only monitor stays powered off long enough to drop its link, Hyprland moves everything onto a headless
FALLBACKmonitor and clears focus. When the real monitor comes back it doesn't focus anything again.The result is a session that looks fine but takes no keyboard input. The window keeps its focus border, the bar still names it,
hyprctl activewindowstill reports it, and nothing you type reaches any client. You have to switch workspace or window by hand to get it back. On a stock idle setup you hit this every time you leave the machine for more than about 10 minutes.Upstream considers it intended, so it isn't going to be fixed there:
Omarchy's idle lock is what powers the display down, so it seemed fair to handle it here.
What
New
default/hypr/monitor-focus.lua, required fromdefault/hypr/omarchy.lua.It remembers the focused workspace and window when a real monitor goes away, then puts focus back once the monitor returns.
FALLBACKround trip counts. Unplugging one of several monitors leaves things alone, sinceFALLBACKonly appears when no real output is left.How it was verified
On Omarchy
4.0.1-1, Hyprland0.56.2-1, single LG UltraGear onHDMI-A-1, NVIDIA RTX 4070.Two real occurrences, a 4h52m lock and a 22m36s one. Both restored focus straight away, no manual workspace switch. Socket trace from the second:
Before the change, the same wake produced no
activewindowevent at all after the monitor returned, and input stayed dead until a manual switch.restore_focuswas also exercised directly for the branches a real wake doesn't reach in one run: hop taken when the target workspace is already current, hop skipped when it isn't, and the most recently focused window used when the saved address no longer resolves.Left out
No retry if the restore itself doesn't take. One dispatch 500ms after the monitor is back was enough in both real runs, and retries risk yanking you off a workspace you've since moved to. Could we add one later if it turns out to be flaky on other hardware? 🤔
The 500ms delay is inherited from the workaround in the upstream discussion. I didn't tune it, it worked first time here.