quickshell: animate calendar close on focus loss

Intercept grabFocus hide via onVisibleChanged — re-show popup
briefly and animate height to 0 before truly hiding it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 15:11:57 +01:00
parent e271a79235
commit 25856f114f

View file

@ -518,10 +518,11 @@ in
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: { onClicked: {
if (calPopup.visible) { if (calPopup.visible && !calPopup.closing) {
calPopup.closing = true;
calPopup.open = false; calPopup.open = false;
calCloseTimer.start(); calCloseTimer.start();
} else { } else if (!calPopup.visible) {
calPopup.visible = true; calPopup.visible = true;
} }
} }
@ -530,7 +531,7 @@ in
Timer { Timer {
id: calCloseTimer id: calCloseTimer
interval: 230 interval: 230
onTriggered: calPopup.visible = false onTriggered: { calPopup.closing = false; calPopup.visible = false; }
} }
} }
@ -841,6 +842,7 @@ in
color: "transparent" color: "transparent"
property bool open: false property bool open: false
property bool closing: false
property real fullWidth: calCol.width + 32 property real fullWidth: calCol.width + 32
property real fullHeight: calCol.height + 24 property real fullHeight: calCol.height + 24
@ -849,12 +851,11 @@ in
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
open = true; if (!closing) open = true;
} } else if (open && !closing) {
} // grabFocus hid us re-show and animate closed
closing = true;
onActiveChanged: { visible = true;
if (!active && visible) {
open = false; open = false;
calCloseTimer.start(); calCloseTimer.start();
} }