From 8d7a81ce02aa91006e0d09aa51436a8049b8babf Mon Sep 17 00:00:00 2001 From: rope Date: Tue, 26 May 2026 13:35:00 +0100 Subject: [PATCH] quickshell: morphing calendar popup animation Co-Authored-By: Claude Opus 4.6 --- settings/hyprland.nix | 54 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/settings/hyprland.nix b/settings/hyprland.nix index fc55319..06a93dc 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -517,7 +517,20 @@ in MouseArea { 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 visible: false 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 { id: calContent - width: calCol.width + 32 - height: calCol.height + 24 + anchors.horizontalCenter: parent.horizontalCenter + y: 1 + width: calPopup.open ? calPopup.fullWidth : 40 + height: calPopup.open ? calPopup.fullHeight : 4 + radius: calPopup.open ? 8 : 2 color: "#${c.base00}" border.color: "#${c.base03}" 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 { id: calCol anchors.centerIn: parent spacing: 8 + opacity: calPopup.open ? 1.0 : 0.0 + + Behavior on opacity { + NumberAnimation { duration: 180; easing.type: Easing.OutCubic } + } // Date header Text {