From 006b6c00d99e1613db6d811393d36f553c372c8a Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 14 May 2025 23:29:44 +0200 Subject: [PATCH] put osds into loaders --- .../OnScreenDisplayBrightness.qml | 94 +++++++++--------- .../onScreenDisplay/OnScreenDisplayVolume.qml | 95 ++++++++++--------- 2 files changed, 100 insertions(+), 89 deletions(-) diff --git a/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayBrightness.qml b/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayBrightness.qml index 8740c356f..f154fbd56 100644 --- a/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayBrightness.qml +++ b/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayBrightness.qml @@ -47,62 +47,68 @@ Scope { Variants { model: Quickshell.screens - PanelWindow { + Loader { + id: osdLoader property var modelData + active: showOsdValues - screen: modelData - exclusionMode: ExclusionMode.Normal - WlrLayershell.namespace: "quickshell:onScreenDisplay" - WlrLayershell.layer: WlrLayer.Overlay - color: "transparent" + PanelWindow { + property var modelData - anchors { - top: true - } - mask: Region { - item: osdValuesWrapper - } + screen: modelData + exclusionMode: ExclusionMode.Normal + WlrLayershell.namespace: "quickshell:onScreenDisplay" + WlrLayershell.layer: WlrLayer.Overlay + color: "transparent" - implicitWidth: columnLayout.implicitWidth - implicitHeight: columnLayout.implicitHeight - visible: showOsdValues - - ColumnLayout { - id: columnLayout - anchors.horizontalCenter: parent.horizontalCenter - Item { - height: 1 // Prevent Wayland protocol error + anchors { + top: true + } + mask: Region { + item: osdValuesWrapper } - Item { - id: osdValuesWrapper - // Extra space for shadow - implicitHeight: true ? (osdValues.implicitHeight + Appearance.sizes.elevationMargin * 2) : 0 - implicitWidth: osdValues.implicitWidth + Appearance.sizes.elevationMargin * 2 - clip: true - MouseArea { - anchors.fill: parent - hoverEnabled: true - onEntered: root.showOsdValues = false + implicitWidth: columnLayout.implicitWidth + implicitHeight: columnLayout.implicitHeight + visible: osdLoader.active + + ColumnLayout { + id: columnLayout + anchors.horizontalCenter: parent.horizontalCenter + Item { + height: 1 // Prevent Wayland protocol error } + Item { + id: osdValuesWrapper + // Extra space for shadow + implicitHeight: true ? (osdValues.implicitHeight + Appearance.sizes.elevationMargin * 2) : 0 + implicitWidth: osdValues.implicitWidth + Appearance.sizes.elevationMargin * 2 + clip: true - Behavior on implicitHeight { - NumberAnimation { - duration: Appearance.animation.menuDecel.duration - easing.type: Appearance.animation.menuDecel.type + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: root.showOsdValues = false + } + + Behavior on implicitHeight { + NumberAnimation { + duration: Appearance.animation.menuDecel.duration + easing.type: Appearance.animation.menuDecel.type + } + } + + OsdValueIndicator { + id: osdValues + anchors.centerIn: parent + value: Brightness.value + icon: "light_mode" + name: qsTr("Brightness") } } - - OsdValueIndicator { - id: osdValues - anchors.centerIn: parent - value: Brightness.value - icon: "light_mode" - name: qsTr("Brightness") - } } - } + } } } diff --git a/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayVolume.qml b/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayVolume.qml index 7206fdfd1..6225f4a95 100644 --- a/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayVolume.qml +++ b/.config/quickshell/modules/onScreenDisplay/OnScreenDisplayVolume.qml @@ -51,62 +51,67 @@ Scope { Variants { model: Quickshell.screens - PanelWindow { + Loader { + id: osdLoader property var modelData + active: showOsdValues + PanelWindow { + property var modelData - screen: modelData - exclusionMode: ExclusionMode.Normal - WlrLayershell.namespace: "quickshell:onScreenDisplay" - WlrLayershell.layer: WlrLayer.Overlay - color: "transparent" + screen: modelData + exclusionMode: ExclusionMode.Normal + WlrLayershell.namespace: "quickshell:onScreenDisplay" + WlrLayershell.layer: WlrLayer.Overlay + color: "transparent" - anchors { - top: true - } - mask: Region { - item: osdValuesWrapper - } - - implicitWidth: columnLayout.implicitWidth - implicitHeight: columnLayout.implicitHeight - visible: showOsdValues - - ColumnLayout { - id: columnLayout - anchors.horizontalCenter: parent.horizontalCenter - Item { - height: 1 // Prevent Wayland protocol error + anchors { + top: true + } + mask: Region { + item: osdValuesWrapper } - Item { - id: osdValuesWrapper - // Extra space for shadow - implicitHeight: true ? (osdValues.implicitHeight + Appearance.sizes.elevationMargin * 2) : 0 - implicitWidth: osdValues.implicitWidth + Appearance.sizes.elevationMargin * 2 - clip: true - MouseArea { - anchors.fill: parent - hoverEnabled: true - onEntered: root.showOsdValues = false + implicitWidth: columnLayout.implicitWidth + implicitHeight: columnLayout.implicitHeight + visible: osdLoader.active + + ColumnLayout { + id: columnLayout + anchors.horizontalCenter: parent.horizontalCenter + Item { + height: 1 // Prevent Wayland protocol error } + Item { + id: osdValuesWrapper + // Extra space for shadow + implicitHeight: true ? (osdValues.implicitHeight + Appearance.sizes.elevationMargin * 2) : 0 + implicitWidth: osdValues.implicitWidth + Appearance.sizes.elevationMargin * 2 + clip: true - Behavior on implicitHeight { - NumberAnimation { - duration: Appearance.animation.menuDecel.duration - easing.type: Appearance.animation.menuDecel.type + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: root.showOsdValues = false + } + + Behavior on implicitHeight { + NumberAnimation { + duration: Appearance.animation.menuDecel.duration + easing.type: Appearance.animation.menuDecel.type + } + } + + OsdValueIndicator { + id: osdValues + anchors.centerIn: parent + value: Audio.sink?.audio.volume ?? 0 + icon: Audio.sink?.audio.muted ? "volume_off" : "volume_up" + name: qsTr("Volume") } } - - OsdValueIndicator { - id: osdValues - anchors.centerIn: parent - value: Audio.sink?.audio.volume ?? 0 - icon: Audio.sink?.audio.muted ? "volume_off" : "volume_up" - name: qsTr("Volume") - } } - } + } } }