quickshell: move OSD into its own overlay window

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-16 13:43:29 +01:00
parent 52599fd24d
commit d1c92394e5
2 changed files with 133 additions and 110 deletions

View file

@ -261,6 +261,7 @@ in
-- Layer rules: blur behind bar and toasts
hl.layer_rule({ match = { namespace = "quickshell-bar" }, blur = true, ignore_alpha = 0.3 })
hl.layer_rule({ match = { namespace = "quickshell-osd" }, blur = true, ignore_alpha = 0.3 })
-- Startup
hl.on("hyprland.start", function()

View file

@ -1790,10 +1790,6 @@ in
required property var shellRoot
screen: modelData
WlrLayershell.namespace: "quickshell-bar"
// Hyprland doesn't render the top layer under a fullscreen
// window, so the OSD would be invisible exactly when a video
// is playing. Ride the overlay layer while it's on screen.
WlrLayershell.layer: osdItem.shown ? WlrLayer.Overlay : WlrLayer.Top
// OnDemand + HyprlandFocusGrab is the working combination
// (caelestia's): the grab redirects focus to this window and
// OnDemand lets the layer surface accept it. Exclusive fights
@ -6948,6 +6944,29 @@ in
// is needed. Brightness arrives via shellRoot's signal instead,
// because sysfs backlight notifies with POLLPRI, which inotify
// never sees. Focused monitor only.
// Its own window, not part of the bar's surface: Hyprland
// doesn't render the top layer under a fullscreen window, so an
// OSD drawn into the bar is invisible exactly when a video is
// playing. Overlay layer, sized to the bar strip, click-through,
// and only mapped while the OSD is on screen so a fullscreen
// video gets the slider alone, no bar and no frame.
PanelWindow {
id: osdWin
screen: bar.screen
visible: osdItem.shown || osdItem.opacity > 0.01
WlrLayershell.namespace: "quickshell-osd"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
// Ignore the bar's exclusive zone so this surface starts at
// y=0 like the bar's does osdItem then reuses the bar's
// own coordinates to line up with the server glance slot.
exclusionMode: ExclusionMode.Ignore
anchors { top: true; left: true; bottom: true }
implicitWidth: Theme.barWidth
color: "transparent"
// Empty region: no input, clicks reach the video underneath.
mask: Region {}
Item {
id: osdItem
readonly property bool isFocused: Hyprland.focusedMonitor
@ -6964,8 +6983,10 @@ in
// dependence on how tall the workspace column has grown.
width: Theme.barWidth
height: 170
anchors.horizontalCenter: barBgRect.horizontalCenter
anchors.verticalCenter: srvWidget.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
// Both surfaces span the full screen height from y=0, so
// the bar's coordinates carry over unchanged.
y: srvWidget.y + srvWidget.height / 2 - height / 2
opacity: shown ? 1 : 0
visible: opacity > 0.01
@ -7065,6 +7086,7 @@ in
}
}
}
}
// Notification Toast (only on primary screen)
Item {