volume osd: only show on focused screen

This commit is contained in:
end-4
2025-05-18 00:26:42 +02:00
parent 4fa53bb4fc
commit 27ca14d208
@@ -12,6 +12,7 @@ import Quickshell.Hyprland
Scope { Scope {
id: root id: root
property bool showOsdValues: false property bool showOsdValues: false
property ShellScreen focusedScreen: Quickshell.screens.find(s => s.name === Hyprland.focusedMonitor?.name)
function triggerOsd() { function triggerOsd() {
showOsdValues = true showOsdValues = true
@@ -47,23 +48,26 @@ Scope {
} }
} }
Variants {
model: Quickshell.screens
Loader { Loader {
id: osdLoader id: osdLoader
property var modelData
active: showOsdValues active: showOsdValues
PanelWindow { PanelWindow {
screen: modelData id: osdRoot
Connections {
target: root
function onFocusedScreenChanged() {
osdRoot.screen = root.focusedScreen
}
}
exclusionMode: ExclusionMode.Normal exclusionMode: ExclusionMode.Normal
WlrLayershell.namespace: "quickshell:onScreenDisplay" WlrLayershell.namespace: "quickshell:onScreenDisplay"
WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.layer: WlrLayer.Overlay
color: "transparent" color: "transparent"
anchors { anchors.top: true
top: true
}
mask: Region { mask: Region {
item: osdValuesWrapper item: osdValuesWrapper
} }
@@ -111,8 +115,6 @@ Scope {
} }
} }
}
IpcHandler { IpcHandler {
target: "osdVolume" target: "osdVolume"