KeyboardPanel dismissal recreates N-1 full-screen layer-shell surfaces on every open — laggy on many-monitor setups
System details
Intel i9-14900HX / NVIDIA RTX 4070 Max-Q (mobile, hybrid), Omarchy 4.0.2-1, 5 monitors
What's wrong?
Opening any bar panel that uses Ui/KeyboardPanel.qml (weather, network, bluetooth, audio, monitor, power, tailscale, agents, and any bar-widget plugin built on it — basically everything except the couple built on PopupCard.qml) takes a perceptible moment on a many-monitor setup, every single time, not just on first open.
Cause: KeyboardPanel.qml's outside-click dismissal for other outputs is implemented as:
Variants {
model: root.open ? Quickshell.screens : []
delegate: Component {
PanelWindow { ... WlrLayershell.namespace: "omarchy-keyboard-panel-dismiss" ... }
}
}
This creates N-1 full-screen transparent layer-shell surfaces (one per other monitor) on every single panel open, and destroys them again on close. That's a real Wayland surface map/unmap round-trip per surface, per open, scaling linearly with monitor count. On a 5-monitor setup this is 4 extra surface creations on every panel open — confirmed via hyprctl layers showing the omarchy-keyboard-panel-dismiss layers appear/disappear in lockstep with each open/close.
Existing lighter pattern in the same codebase: Ui/PopupCard.qml dismisses outside clicks via Hyprland's HyprlandFocusGrab instead, which needs no extra surfaces at all.
A fix we tried and do NOT recommend: keeping the Variants model always Quickshell.screens and relying only on the delegate's visible: root.open && ... binding to hide it when not needed. This does eliminate the per-open lag, but visible: false on this PanelWindow does not actually unmap the underlying wlr-layer-shell surface — it stayed mapped and kept accepting pointer input on every monitor, all the time, including while every panel was closed. Result: a full-screen invisible click-blocker on every screen, mouse completely unusable (keyboard still worked), until reverted. Do not ship this exact change.
Suggested direction instead: follow Ui/PopupCard.qml's existing pattern — HyprlandFocusGrab for outside-click dismissal needs no extra per-monitor surfaces at all, so it sidesteps this whole class of cost rather than trying to cache it.
One real wrinkle for whoever attempts that: KeyboardPanel.qml's own header comment notes that WlrKeyboardFocus.Exclusive "makes Hyprland route every pointer event to the exclusive surface no matter which output the cursor is over" — i.e. this component's existing Exclusive→OnDemand focus-prime dance exists specifically because compositor-wide (not per-output) pointer routing bit it once already. PopupCard.qml (a PopupWindow/xdg-popup) has no such priming logic to interact with. Whether HyprlandFocusGrab on a layer-shell PanelWindow that also toggles WlrLayershell.keyboardFocus between Exclusive/OnDemand/None plays nicely together is untested — we did not attempt it live given the blast radius (a bad interaction here reproduces the exact all-monitor input lockout above, not just a cosmetic bug), and would want it verified in a proper dev/test setup rather than on a live multi-monitor desktop.
Repro:
- Have 3+ monitors active.
- Open any KeyboardPanel-based bar panel (e.g. weather).
hyprctl layerswhile it's open — noteomarchy-keyboard-panel-dismisson every other monitor.- Close it, reopen it — same lag every time, not just first open.
@jacobtminson I prototyped the "HyprlandFocusGrab" direction you suggested here, rather than trying to cache the dismissal windows.
Branch: https://github.com/kvnloo/omarchy/tree/investigate/keyboard-panel-input-10875
Exact commit: https://github.com/kvnloo/omarchy/commit/11c15914fec46a5c8068990d54557102a21fb496
The shared "KeyboardPanel.qml" change is currently +21 / -118 lines.
The new shape is:
- keep the full-screen backing layer for stable positioning / keyboard focus
- restrict its pointer input to "mask: Region { item: card }"
- use "HyprlandFocusGrab" for outside-click dismissal
- whitelist the real bar window so sibling bar buttons receive their real click
- remove every "omarchy-keyboard-panel-dismiss" surface
- remove the full-screen dismissal "MouseArea"
- remove the second/manual bar hit-test + click-forwarding path
I also added an acceptance case that creates a real second Hyprland headless output and verifies one open "omarchy-keyboard-panel", zero dismissal twins, Escape after the keyboard-focus prime, and repeated open/close cycles without extra surfaces.
The remaining test I can't honestly cover in that VM fixture is the one your 5-monitor setup is ideal for:
- Open any KeyboardPanel panel.
- Click an application on another physical monitor → panel should close and the click should work normally.
- Open it again and click another bar panel icon → it should switch in one click.
- Repeat a bunch of times and confirm there are still zero "omarchy-keyboard-panel-dismiss" layers and no input lockout.
If that behaves correctly on your setup, I think this is a much cleaner fix for the underlying ownership problem than optimizing the N-1 dismissal surfaces.
I reproduced this on a worker VM (Omarchy installed from the ISO), running quattro at be7c7bf37. The dismissal windows account for nearly all of the extra time.
Mechanism. shell/Ui/KeyboardPanel.qml:344 binds the Variants model to root.open ? Quickshell.screens : [], so every open creates a PanelWindow per output and maps a full-screen omarchy-keyboard-panel-dismiss surface on each output except the panel's own. Every close destroys them again. All 11 panels built on KeyboardPanel inherit this: weather, network, bluetooth, audio, monitor, power, tailscale, clock, dropbox, elsewhen and agents.
Measurement. I timed omarchy-shell shell summon omarchy.bluetooth until the panel layer appeared in hyprctl layers, 12 opens per case:
- 1 output: 15–33 ms.
- 5 outputs (4 headless outputs added with
hyprctl output create headless): 138–296 ms, with 4 dismissal layers each time. - 5 outputs, with the dismissal
Variantsremoved as a control: 17–43 ms.
The cost comes from the per-open surfaces and not from having more outputs. It is paid on every open, as you describe. These numbers come from a software-rendered VM, so the absolute times on your NVIDIA machine will differ.
Why I didn't open a fix. The twins were added by #6487, together with the Exclusive→OnDemand focus change, to make clicks on other monitors dismiss the panel. Replacing them is a choice between designs, not a contained correction:
HyprlandFocusGrab, as inPopupCard.qml:83. This needs more than the grab itself. The panel's input mask currently covers the whole screen (KeyboardPanel.qml:125) and would have to shrink to the card. Clicks on the bar are currently forwarded explicitly (KeyboardPanel.qml:303-332), and whitelisting the bar window changes that. How the grab interacts with the 75 ms Exclusive focus prime is unverified.- Persistent twins with an empty input mask while closed. This avoids remapping but leaves N-1 overlay surfaces mapped all the time.
@kvnloo's prototype branch takes the first route. It is not a pull request, so I have not reviewed it.
The same pattern is proposed for the system menu in #14720 (omarchy-menu-dismiss), so the choice made here should apply there too.
Codex at medium effort reviewed this independently. It agreed on the mechanism and that the fix is a design decision. It added the input-mask and bar-whitelisting points above. Its independence from my reasoning is not guaranteed. This now waits on the maintainer to pick a direction.
omarchybot reproduced — dismiss Variants dominate open latency on multi-monitor. Agree with HyprlandFocusGrab (PopupCard pattern) over caching always-mapped dismiss surfaces (the click-blocker footgun you already hit).
Related KeyboardPanel work: #11751/#13648 (unmap on owner.close throw), #9598 (scale visibility).