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

@ -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()
}
}
}
}