summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/Clock.qml
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-09-02 11:03:16 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-09-02 11:03:16 +0200
commit7b6f07aff506155ad0dbd574ed5aafa3e2870613 (patch)
treea8e35964cdc7338b307b5797f9b1ea328cb89d72 /accounts/gkleen@sif/shell/quickshell/Clock.qml
parent85bf62eaa2fd71eb15ef401e537457fb9098a540 (diff)
downloadnixos-7b6f07aff506155ad0dbd574ed5aafa3e2870613.tar
nixos-7b6f07aff506155ad0dbd574ed5aafa3e2870613.tar.gz
nixos-7b6f07aff506155ad0dbd574ed5aafa3e2870613.tar.bz2
nixos-7b6f07aff506155ad0dbd574ed5aafa3e2870613.tar.xz
nixos-7b6f07aff506155ad0dbd574ed5aafa3e2870613.zip
...
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Clock.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Clock.qml20
1 files changed, 12 insertions, 8 deletions
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 {
79 color: "black" 79 color: "black"
80 80
81 onVisibleChanged: { 81 onVisibleChanged: {
82 const d = new Date(); 82 yearCalendar.year = systemClock.date.getFullYear();
83 yearCalendar.year = d.getFullYear();
84 clockMouseArea.angleRem = 0; 83 clockMouseArea.angleRem = 0;
85 } 84 }
86 85
@@ -118,7 +117,7 @@ Item {
118 } 117 }
119 118
120 GridLayout { 119 GridLayout {
121 property int year: { const d = new Date(); return d.getFullYear(); } 120 property int year: systemClock.date.getFullYear()
122 121
123 id: yearCalendar 122 id: yearCalendar
124 123
@@ -129,6 +128,12 @@ Item {
129 Layout.alignment: Qt.AlignHCenter 128 Layout.alignment: Qt.AlignHCenter
130 Layout.fillWidth: false 129 Layout.fillWidth: false
131 130
131 SystemClock {
132 id: systemClock
133
134 precision: SystemClock.Minutes
135 }
136
132 Repeater { 137 Repeater {
133 model: 12 138 model: 12
134 139
@@ -152,10 +157,7 @@ Item {
152 font.pointSize: 10 157 font.pointSize: 10
153 font.family: "Fira Sans" 158 font.family: "Fira Sans"
154 159
155 text: { 160 text: new Date(yearCalendar.year, monthCalendar.month, 1).toLocaleString(Qt.locale("en_DK"), "MMMM")
156 const date = Date.fromLocaleDateString(Qt.locale(), `${yearCalendar.year}-${monthCalendar.month + 1}-01`, "yyyy-M-dd");
157 return date.toLocaleString(Qt.locale("en_DK"), "MMMM")
158 }
159 161
160 color: "#ffead3" 162 color: "#ffead3"
161 } 163 }
@@ -242,8 +244,10 @@ Item {
242 font.family: "Fira Sans" 244 font.family: "Fira Sans"
243 font.features: { "tnum": 1 } 245 font.features: { "tnum": 1 }
244 246
247 property bool today: systemClock.date.getFullYear() == model.year && systemClock.date.getMonth() == model.month && systemClock.date.getDate() == model.day
248
245 text: model.day 249 text: model.day
246 color: model.today ? "#ff6699" : "white" 250 color: today ? "#ff6699" : "white"
247 251
248 horizontalAlignment: Text.AlignRight 252 horizontalAlignment: Text.AlignRight
249 verticalAlignment: Text.AlignVCenter 253 verticalAlignment: Text.AlignVCenter