add animation to volpop

This commit is contained in:
lucy 2026-08-28 18:08:38 +02:00
commit f9acf2fe0f
2 changed files with 58 additions and 31 deletions

View file

@ -1,10 +1,7 @@
import Quickshell import Quickshell
import Quickshell.Services.Pipewire
import QtQuick import QtQuick
import QtQuick.Layouts import QtQuick.Layouts
import qs.modules.applets
import qs.widgets import qs.widgets
import qs.settings
import qs.modules.Services import qs.modules.Services
BarComponent { BarComponent {

View file

@ -8,8 +8,10 @@ import qs.settings
Variants { Variants {
model: Quickshell.screens model: Quickshell.screens
delegate: PanelWindow { delegate: PanelWindow {
id: root
required property ShellScreen modelData required property ShellScreen modelData
aboveWindows: true property bool shown: WidgetTracker.current !== "" && WidgetTracker.screen === modelData
screen: modelData screen: modelData
anchors { anchors {
top: true top: true
@ -19,8 +21,11 @@ Variants {
} }
exclusionMode: ExclusionMode.Ignore exclusionMode: ExclusionMode.Ignore
color: 'transparent' color: 'transparent'
visible: WidgetTracker.current !== "" && WidgetTracker.screen === modelData visible: true
WlrLayershell.keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None mask: Region {
item: root.shown ? dismisser : null
}
WlrLayershell.keyboardFocus: shown ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
Item { Item {
anchors.fill: parent anchors.fill: parent
focus: true focus: true
@ -28,31 +33,56 @@ Variants {
WidgetTracker.close(); WidgetTracker.close();
event.accepted = true; event.accepted = true;
} }
VolPopup { VolPopup {
z: 1 z: 1
visible: WidgetTracker.current === "volume" id: volPopup
anchors.right: parent.right property bool shown: WidgetTracker.current === "volume"
anchors.top: parent.top opacity: shown ? 1 : 0
anchors.topMargin: Config.cfg.bar.floating ? Config.cfg.bar.height + 20 : Config.cfg.bar.height visible: opacity > 0
anchors.rightMargin: 10 anchors.right: parent.right
anchors.top: parent.top
} anchors.topMargin: Config.cfg.bar.floating ? Config.cfg.bar.height + 20 : Config.cfg.bar.height
WallPicker { anchors.rightMargin: 10
z: 1 Behavior on opacity {
anchors.bottom: parent.bottom NumberAnimation {
anchors.left: parent.left duration: 140
anchors.right: parent.right easing.type: Easing.OutCubic
anchors.margins: 20 }
implicitWidth: 1000 }
implicitHeight: 200 transform: Translate {
visible: WidgetTracker.current === "wallpapers" y: volPopup.shown ? 0 : -12
} Behavior on y {
MouseArea { NumberAnimation {
z: 0 duration: 140
anchors.fill: parent easing.type: Easing.OutCubic
acceptedButtons: Qt.LeftButton }
onClicked: WidgetTracker.close() }
} }
}
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()
}
} }
} }
} }