From 7b6f07aff506155ad0dbd574ed5aafa3e2870613 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 2 Sep 2025 11:03:16 +0200 Subject: ... --- accounts/gkleen@sif/shell/quickshell/Clock.qml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'accounts/gkleen@sif/shell/quickshell/Clock.qml') diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index d645cfa7..744b187f 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml @@ -79,8 +79,7 @@ Item { color: "black" onVisibleChanged: { - const d = new Date(); - yearCalendar.year = d.getFullYear(); + yearCalendar.year = systemClock.date.getFullYear(); clockMouseArea.angleRem = 0; } @@ -118,7 +117,7 @@ Item { } GridLayout { - property int year: { const d = new Date(); return d.getFullYear(); } + property int year: systemClock.date.getFullYear() id: yearCalendar @@ -129,6 +128,12 @@ Item { Layout.alignment: Qt.AlignHCenter Layout.fillWidth: false + SystemClock { + id: systemClock + + precision: SystemClock.Minutes + } + Repeater { model: 12 @@ -152,10 +157,7 @@ Item { font.pointSize: 10 font.family: "Fira Sans" - text: { - const date = Date.fromLocaleDateString(Qt.locale(), `${yearCalendar.year}-${monthCalendar.month + 1}-01`, "yyyy-M-dd"); - return date.toLocaleString(Qt.locale("en_DK"), "MMMM") - } + text: new Date(yearCalendar.year, monthCalendar.month, 1).toLocaleString(Qt.locale("en_DK"), "MMMM") color: "#ffead3" } @@ -242,8 +244,10 @@ Item { font.family: "Fira Sans" font.features: { "tnum": 1 } + property bool today: systemClock.date.getFullYear() == model.year && systemClock.date.getMonth() == model.month && systemClock.date.getDate() == model.day + text: model.day - color: model.today ? "#ff6699" : "white" + color: today ? "#ff6699" : "white" horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter -- cgit v1.2.3