Keep the bar mapped while hidden so revealing it is instant (#6677)

* Keep the bar mapped while hidden so revealing it is instant

Hiding the bar set the panel invisible, which unmaps the layer surface and
releases the scene graph with it. Every reveal then had to rebuild all of
it: a new layer surface, a configure roundtrip, re-shaped glyphs and
re-uploaded textures, and a first frame before anything appeared.

Measured on a 2560x1440 screen, showing took 155-175ms against 20ms to
hide, and 400-595ms on the first reveal after a cold start. Splitting the
cost showed the exclusive-zone reflow was not to blame: show latency was
the same on an empty workspace as on a tiled one, and windows finished
moving ~15ms after the bar was already on screen.

Park the bar one bar-width past its anchored edge instead, and drop its
exclusion zone while hidden. The surface stays alive, so showing is only
a margin change: 10-14ms in both directions, at every bar position.

Since a hidden bar is now mapped, layer_present no longer proves the bar
is visible; the session acceptance test asserts on-screen geometry.

* Fix layer visibility checks on offset monitors

* Handle rotated outputs in layer visibility checks

* Cover hidden bar behavior in acceptance tests

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
Vivek
2026-08-10 14:10:31 +02:00
committed by GitHub
co-authored by David Heinemeier Hansson
parent 354c2f0060
commit 7633d8dee4
5 changed files with 134 additions and 5 deletions
+28
View File
@@ -79,6 +79,34 @@ layer_absent() {
! layer_present "$1"
}
# A layer can be mapped but parked off the monitor: the bar hides that way so
# revealing it does not have to rebuild the surface. Assert on geometry when
# what matters is that the user can actually see it. Layer boxes are local to
# their monitor and in logical coordinates, so compare them with local bounds
# derived from the monitor's scaled pixel size.
layer_on_screen() {
local monitors
monitors=$(hyprctl -j monitors) || return 1
hyprctl -j layers | jq -e --arg ns "$1" --argjson monitors "$monitors" '
to_entries[]
| .key as $name
| .value as $levels
| ($monitors[] | select(.name == $name)) as $m
| (if ($m.transform // 0) % 2 == 1 then $m.height else $m.width end) / $m.scale | round as $width
| (if ($m.transform // 0) % 2 == 1 then $m.width else $m.height end) / $m.scale | round as $height
| [$levels | .. | objects | select(.namespace? == $ns)][]
| select(
.x + .w > 0 and .x < $width and
.y + .h > 0 and .y < $height
)
' >/dev/null
}
layer_off_screen() {
! layer_on_screen "$1"
}
# Close every window matching a class regex, by address so multi-window apps
# are fully closed. Tries the quattro Lua dispatcher first, then classic.
close_windows() {