From f9acf2fe0f4ac76665e6ca567e15b2194aa01055 Mon Sep 17 00:00:00 2001 From: lucy Date: Fri, 28 Aug 2026 18:08:38 +0200 Subject: [PATCH] add animation to volpop --- modules/bar/Pw.qml | 3 -- modules/overlays/Top.qml | 86 +++++++++++++++++++++++++++------------- 2 files changed, 58 insertions(+), 31 deletions(-) diff --git a/modules/bar/Pw.qml b/modules/bar/Pw.qml index dbeab97..be37914 100644 --- a/modules/bar/Pw.qml +++ b/modules/bar/Pw.qml @@ -1,10 +1,7 @@ import Quickshell -import Quickshell.Services.Pipewire import QtQuick import QtQuick.Layouts -import qs.modules.applets import qs.widgets -import qs.settings import qs.modules.Services BarComponent { diff --git a/modules/overlays/Top.qml b/modules/overlays/Top.qml index 8079d61..4459ea9 100644 --- a/modules/overlays/Top.qml +++ b/modules/overlays/Top.qml @@ -8,8 +8,10 @@ import qs.settings Variants { model: Quickshell.screens delegate: PanelWindow { + id: root required property ShellScreen modelData - aboveWindows: true + property bool shown: WidgetTracker.current !== "" && WidgetTracker.screen === modelData + screen: modelData anchors { top: true @@ -19,8 +21,11 @@ Variants { } exclusionMode: ExclusionMode.Ignore color: 'transparent' - visible: WidgetTracker.current !== "" && WidgetTracker.screen === modelData - WlrLayershell.keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None + visible: true + mask: Region { + item: root.shown ? dismisser : null + } + WlrLayershell.keyboardFocus: shown ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None Item { anchors.fill: parent focus: true @@ -28,31 +33,56 @@ Variants { WidgetTracker.close(); event.accepted = true; } - VolPopup { - z: 1 - visible: WidgetTracker.current === "volume" - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: Config.cfg.bar.floating ? Config.cfg.bar.height + 20 : Config.cfg.bar.height - anchors.rightMargin: 10 - - } - WallPicker { - z: 1 - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: 20 - implicitWidth: 1000 - implicitHeight: 200 - visible: WidgetTracker.current === "wallpapers" - } - MouseArea { - z: 0 - anchors.fill: parent - acceptedButtons: Qt.LeftButton - onClicked: WidgetTracker.close() - } + VolPopup { + z: 1 + id: volPopup + property bool shown: WidgetTracker.current === "volume" + opacity: shown ? 1 : 0 + visible: opacity > 0 + anchors.right: parent.right + anchors.top: parent.top + anchors.topMargin: Config.cfg.bar.floating ? Config.cfg.bar.height + 20 : Config.cfg.bar.height + anchors.rightMargin: 10 + Behavior on opacity { + NumberAnimation { + duration: 140 + easing.type: Easing.OutCubic + } + } + transform: Translate { + y: volPopup.shown ? 0 : -12 + Behavior on y { + NumberAnimation { + duration: 140 + easing.type: Easing.OutCubic + } + } + } + } + WallPicker { + z: 1 + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 20 + implicitWidth: 1000 + implicitHeight: 200 + visible: WidgetTracker.current === "wallpapers" + Behavior on visible { + PropertyAnimation { + duration: 350 + easing.type: Easing.InOutBack + easing.overshoot: 1.2 + } + } + } + MouseArea { + id: dismisser + z: 0 + anchors.fill: parent + acceptedButtons: Qt.LeftButton + onClicked: WidgetTracker.close() + } } } }