quickshell: morphing calendar popup animation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 13:35:00 +01:00
parent 0156255cac
commit 8d7a81ce02

View file

@ -517,7 +517,20 @@ in
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: calPopup.visible = !calPopup.visible onClicked: {
if (calPopup.visible) {
calPopup.open = false;
calCloseTimer.start();
} else {
calPopup.visible = true;
}
}
}
Timer {
id: calCloseTimer
interval: 280
onTriggered: calPopup.visible = false
} }
} }
@ -824,22 +837,51 @@ in
grabFocus: true grabFocus: true
visible: false visible: false
color: "transparent" color: "transparent"
implicitWidth: calContent.width + 2
implicitHeight: calContent.height + 2 property bool open: false
property real fullWidth: calCol.width + 32
property real fullHeight: calCol.height + 24
implicitWidth: fullWidth + 4
implicitHeight: fullHeight + 4
onVisibleChanged: {
if (visible) {
open = true;
}
}
Rectangle { Rectangle {
id: calContent id: calContent
width: calCol.width + 32 anchors.horizontalCenter: parent.horizontalCenter
height: calCol.height + 24 y: 1
width: calPopup.open ? calPopup.fullWidth : 40
height: calPopup.open ? calPopup.fullHeight : 4
radius: calPopup.open ? 8 : 2
color: "#${c.base00}" color: "#${c.base00}"
border.color: "#${c.base03}" border.color: "#${c.base03}"
border.width: 1 border.width: 1
radius: 8 clip: true
Behavior on width {
NumberAnimation { duration: 250; easing.type: Easing.OutCubic }
}
Behavior on height {
NumberAnimation { duration: 250; easing.type: Easing.OutCubic }
}
Behavior on radius {
NumberAnimation { duration: 250; easing.type: Easing.OutCubic }
}
Column { Column {
id: calCol id: calCol
anchors.centerIn: parent anchors.centerIn: parent
spacing: 8 spacing: 8
opacity: calPopup.open ? 1.0 : 0.0
Behavior on opacity {
NumberAnimation { duration: 180; easing.type: Easing.OutCubic }
}
// Date header // Date header
Text { Text {