From c643d26bce539827cbaecd952ae88b6c9e12ea11 Mon Sep 17 00:00:00 2001 From: darksignal7 Date: Sun, 5 Oct 2025 01:55:39 +0300 Subject: [PATCH] add date to clock --- .../ii/modules/background/CookieClock.qml | 39 ++++++++++++++++++- .../quickshell/ii/modules/common/Config.qml | 1 + .../ii/modules/settings/InterfaceConfig.qml | 19 ++++++++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/.config/quickshell/ii/modules/background/CookieClock.qml b/.config/quickshell/ii/modules/background/CookieClock.qml index 6dd352eb1..8fc09a84d 100644 --- a/.config/quickshell/ii/modules/background/CookieClock.qml +++ b/.config/quickshell/ii/modules/background/CookieClock.qml @@ -252,6 +252,7 @@ Item { // Second hand/ dot Item { + id: secondHand z:3 opacity: Config.options.background.clock.cookie.secondHandStyle === "dot" || Config.options.background.clock.cookie.secondHandStyle === "line" ? 1.0 : 0 // Not using visible to allow smooth transition Behavior on opacity { @@ -281,7 +282,43 @@ Item { } } - + // Date + Canvas { + width: cookie.width + height: cookie.height + rotation: secondHand.rotation + 45 // +45 degrees to align with minute hand + opacity: Config.options.background.clock.cookie.dateInClock ? 1.0 : 0 + Behavior on opacity { + animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this) + } + onPaint: { + var ctx = getContext("2d"); + ctx.clearRect(0,0,width,height); + ctx.font = "700 30px gabarito"; + + var text = DateTime.date.substring(0,3) + " " + DateTime.date.substring(4,7); + var radius = 78; + var angleStep = Math.PI / 2.35 / text.length; + + for (var i=0; i= 3) + ctx.fillStyle = root.colOnBackground; + else + ctx.fillStyle = Appearance.colors.colSecondaryHover; + + ctx.fillText(text[i], 0, 0); + ctx.restore(); + } + } + } // Hour Indicator numbers Repeater { diff --git a/.config/quickshell/ii/modules/common/Config.qml b/.config/quickshell/ii/modules/common/Config.qml index 2363e9aa0..2ce21ac8a 100644 --- a/.config/quickshell/ii/modules/common/Config.qml +++ b/.config/quickshell/ii/modules/common/Config.qml @@ -136,6 +136,7 @@ Singleton { property string secondHandStyle: "dot" // Options: "dot", "line" , "none" property bool timeIndicators: true property bool centerGlow: true + property bool dateInClock: true property bool waveAnimation: true } diff --git a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml index 141ce6d1c..5288c6342 100644 --- a/.config/quickshell/ii/modules/settings/InterfaceConfig.qml +++ b/.config/quickshell/ii/modules/settings/InterfaceConfig.qml @@ -84,6 +84,9 @@ ContentPage { if (newValue === "numbers") { Config.options.background.clock.cookie.timeIndicators = false; } + if (newValue != "none"){ + Config.options.background.clock.cookie.dateInClock = false; + } } options: [ { @@ -214,7 +217,21 @@ ContentPage { text: "Can't be turned on when using 'Numbers' dial style for aesthetic reasons" } } - + ConfigSwitch { + enabled: Config.options.background.clock.style === "cookie" && Config.options.background.clock.cookie.dialNumberStyle === "none" + buttonIcon: "farsight_digital" + text: Translation.tr("Date inside clock") + checked: Config.options.background.clock.cookie.dateInClock + onEnabledChanged: { + checked = Config.options.background.clock.cookie.dateInClock + } + onCheckedChanged: { + Config.options.background.clock.cookie.dateInClock = checked; + } + StyledToolTip { + text: "Can only be turned on when not using any dial style for aesthetic reasons" + } + } }