From 1e7e3a84c6f7a4a826ba04497ded1cd19aa87fbd Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 11 Oct 2025 11:47:36 +0200 Subject: [PATCH] put time column in loader, use fewer `Behavior`s --- .../background/cookieClock/CookieClock.qml | 18 ++++++++++--- .../background/cookieClock/TimeColumn.qml | 25 +++++++------------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.config/quickshell/ii/modules/background/cookieClock/CookieClock.qml b/.config/quickshell/ii/modules/background/cookieClock/CookieClock.qml index 22bc6005b..067305017 100644 --- a/.config/quickshell/ii/modules/background/cookieClock/CookieClock.qml +++ b/.config/quickshell/ii/modules/background/cookieClock/CookieClock.qml @@ -77,7 +77,8 @@ Item { anchors.fill: parent color: root.colOnBackground } - + + // Stupid extra hour marks in the middle FadeLoader { id: hourMarksLoader anchors.centerIn: parent @@ -90,11 +91,20 @@ Item { } // Number column in the middle - TimeColumn { + FadeLoader { + id: timeColumnLoader anchors.centerIn: parent - color: root.colOnBackground - clockNumbers: root.clockNumbers + shown: Config.options.background.clock.cookie.timeIndicators + scale: 1.4 - 0.4 * timeColumnLoader.shown + Behavior on scale { + animation: Appearance.animation.elementResize.numberAnimation.createObject(this) + } + + sourceComponent: TimeColumn { + color: root.colOnBackground + } } + // Hour hand HourHand { diff --git a/.config/quickshell/ii/modules/background/cookieClock/TimeColumn.qml b/.config/quickshell/ii/modules/background/cookieClock/TimeColumn.qml index bea8194fe..fb7684010 100644 --- a/.config/quickshell/ii/modules/background/cookieClock/TimeColumn.qml +++ b/.config/quickshell/ii/modules/background/cookieClock/TimeColumn.qml @@ -10,11 +10,11 @@ import QtQuick.Layouts ColumnLayout { id: root - required property list clockNumbers + property list clockNumbers: DateTime.time.split(/[: ]/) property bool isEnabled: Config.options.background.clock.cookie.timeIndicators property color color: Appearance.colors.colOnSecondaryContainer - z: 0 + property bool hourMarksEnabled: Config.options.background.clock.cookie.hourMarks spacing: -16 Repeater { @@ -22,31 +22,24 @@ ColumnLayout { delegate: StyledText { required property string modelData - property bool hourMarksEnabled: Config.options.background.clock.cookie.hourMarks property bool isAmPm: !modelData.match(/\d{2}/i) property real numberSizeWithoutGlow: isAmPm ? 26 : 68 property real numberSizeWithGlow: isAmPm ? 20 : 40 - property real numberSize: root.isEnabled ? (hourMarksEnabled ? numberSizeWithGlow : numberSizeWithoutGlow) : 100 // open/close animation + property real numberSize: root.hourMarksEnabled ? numberSizeWithGlow : numberSizeWithoutGlow anchors.horizontalCenter: root.horizontalCenter - visible: opacity > 0 color: root.color - opacity: root.isEnabled ? 1.0 : 0 - - Behavior on opacity { - animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) - } - - text: modelData.padStart(2, "0") - font { family: Appearance.font.family.expressive weight: Font.Bold pixelSize: numberSize - Behavior on pixelSize { - animation: Appearance.animation.elementResize.numberAnimation.createObject(this) - } } + + Behavior on numberSize { + animation: Appearance.animation.elementResize.numberAnimation.createObject(this) + } + + text: modelData.padStart(2, "0") } } }