summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell/Clock.qml
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Clock.qml')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Clock.qml65
1 files changed, 38 insertions, 27 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml
index 55fabd1c..edce57e3 100644
--- a/accounts/gkleen@sif/shell/quickshell/Clock.qml
+++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml
@@ -7,6 +7,8 @@ import QtQuick.Layouts
7import Quickshell.Widgets 7import Quickshell.Widgets
8 8
9Item { 9Item {
10 id: clockItem
11
10 width: clock.contentWidth 12 width: clock.contentWidth
11 height: parent.height 13 height: parent.height
12 anchors.verticalCenter: parent.verticalCenter 14 anchors.verticalCenter: parent.verticalCenter
@@ -30,22 +32,25 @@ Item {
30 32
31 onWheel: event => scrollYear(event) 33 onWheel: event => scrollYear(event)
32 34
33 Text { 35 Item {
34 id: clock 36 anchors.fill: parent
35 color: "white"
36 37
37 anchors.verticalCenter: parent.verticalCenter 38 Text {
39 id: clock
40 color: "white"
38 41
39 Custom.Chrono { 42 anchors.verticalCenter: parent.verticalCenter
40 id: chrono
41 format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}"
42 }
43 43
44 text: chrono.date 44 Custom.Chrono {
45 id: chrono
46
47 onDateChanged: clock.text = format("W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}")
48 }
45 49
46 font.pointSize: 10 50 font.pointSize: 10
47 font.family: "Fira Sans" 51 font.family: "Fira Sans"
48 font.features: { "tnum": 1 } 52 font.features: { "tnum": 1 }
53 }
49 } 54 }
50 } 55 }
51 56
@@ -73,8 +78,7 @@ Item {
73 color: "black" 78 color: "black"
74 79
75 onVisibleChanged: { 80 onVisibleChanged: {
76 const d = new Date(); 81 yearCalendar.year = chrono.date.getFullYear();
77 yearCalendar.year = d.getFullYear();
78 clockMouseArea.angleRem = 0; 82 clockMouseArea.angleRem = 0;
79 } 83 }
80 84
@@ -112,7 +116,7 @@ Item {
112 } 116 }
113 117
114 GridLayout { 118 GridLayout {
115 property int year: { const d = new Date(); return d.getFullYear(); } 119 property int year: chrono.date.getFullYear()
116 120
117 id: yearCalendar 121 id: yearCalendar
118 122
@@ -146,10 +150,7 @@ Item {
146 font.pointSize: 10 150 font.pointSize: 10
147 font.family: "Fira Sans" 151 font.family: "Fira Sans"
148 152
149 text: { 153 text: new Date(yearCalendar.year, monthCalendar.month, 1).toLocaleString(Qt.locale("en_DK"), "MMMM")
150 const date = Date.fromLocaleDateString(Qt.locale(), `${yearCalendar.year}-${monthCalendar.month + 1}-01`, "yyyy-M-dd");
151 return date.toLocaleString(Qt.locale("en_DK"), "MMMM")
152 }
153 154
154 color: "#ffead3" 155 color: "#ffead3"
155 } 156 }
@@ -161,17 +162,25 @@ Item {
161 Layout.column: 1 162 Layout.column: 1
162 Layout.fillWidth: true 163 Layout.fillWidth: true
163 164
164 delegate: Text { 165 delegate: WrapperItem {
165 required property string shortName 166 required property string shortName
166 167
167 font.pointSize: 10 168 width: dowLabel.contentWidth + 6
168 font.family: "Fira Mono"
169 169
170 text: shortName 170 Text {
171 color: "#ffcc66" 171 id: dowLabel
172 172
173 horizontalAlignment: Text.AlignRight 173 anchors.fill: parent
174 verticalAlignment: Text.AlignVCenter 174
175 font.pointSize: 10
176 font.family: "Fira Sans"
177
178 text: parent.shortName
179 color: "#ffcc66"
180
181 horizontalAlignment: Text.AlignHCenter
182 verticalAlignment: Text.AlignVCenter
183 }
175 } 184 }
176 } 185 }
177 186
@@ -236,8 +245,10 @@ Item {
236 font.family: "Fira Sans" 245 font.family: "Fira Sans"
237 font.features: { "tnum": 1 } 246 font.features: { "tnum": 1 }
238 247
248 property bool today: chrono.date.getFullYear() == model.year && chrono.date.getMonth() == model.month && chrono.date.getDate() == model.day
249
239 text: model.day 250 text: model.day
240 color: model.today ? "#ff6699" : "white" 251 color: today ? "#ff6699" : "white"
241 252
242 horizontalAlignment: Text.AlignRight 253 horizontalAlignment: Text.AlignRight
243 verticalAlignment: Text.AlignVCenter 254 verticalAlignment: Text.AlignVCenter