diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell/Clock.qml')
-rw-r--r-- | accounts/gkleen@sif/shell/quickshell/Clock.qml | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Clock.qml b/accounts/gkleen@sif/shell/quickshell/Clock.qml index d645cfa7..edce57e3 100644 --- a/accounts/gkleen@sif/shell/quickshell/Clock.qml +++ b/accounts/gkleen@sif/shell/quickshell/Clock.qml | |||
@@ -43,10 +43,9 @@ Item { | |||
43 | 43 | ||
44 | Custom.Chrono { | 44 | Custom.Chrono { |
45 | id: chrono | 45 | id: chrono |
46 | format: "W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}" | ||
47 | } | ||
48 | 46 | ||
49 | text: chrono.date | 47 | onDateChanged: clock.text = format("W{0:%V-%u} {0:%F} {0:%H:%M:%S%Ez}") |
48 | } | ||
50 | 49 | ||
51 | font.pointSize: 10 | 50 | font.pointSize: 10 |
52 | font.family: "Fira Sans" | 51 | font.family: "Fira Sans" |
@@ -79,8 +78,7 @@ Item { | |||
79 | color: "black" | 78 | color: "black" |
80 | 79 | ||
81 | onVisibleChanged: { | 80 | onVisibleChanged: { |
82 | const d = new Date(); | 81 | yearCalendar.year = chrono.date.getFullYear(); |
83 | yearCalendar.year = d.getFullYear(); | ||
84 | clockMouseArea.angleRem = 0; | 82 | clockMouseArea.angleRem = 0; |
85 | } | 83 | } |
86 | 84 | ||
@@ -118,7 +116,7 @@ Item { | |||
118 | } | 116 | } |
119 | 117 | ||
120 | GridLayout { | 118 | GridLayout { |
121 | property int year: { const d = new Date(); return d.getFullYear(); } | 119 | property int year: chrono.date.getFullYear() |
122 | 120 | ||
123 | id: yearCalendar | 121 | id: yearCalendar |
124 | 122 | ||
@@ -152,10 +150,7 @@ Item { | |||
152 | font.pointSize: 10 | 150 | font.pointSize: 10 |
153 | font.family: "Fira Sans" | 151 | font.family: "Fira Sans" |
154 | 152 | ||
155 | text: { | 153 | 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 | 154 | ||
160 | color: "#ffead3" | 155 | color: "#ffead3" |
161 | } | 156 | } |
@@ -167,17 +162,25 @@ Item { | |||
167 | Layout.column: 1 | 162 | Layout.column: 1 |
168 | Layout.fillWidth: true | 163 | Layout.fillWidth: true |
169 | 164 | ||
170 | delegate: Text { | 165 | delegate: WrapperItem { |
171 | required property string shortName | 166 | required property string shortName |
172 | 167 | ||
173 | font.pointSize: 10 | 168 | width: dowLabel.contentWidth + 6 |
174 | font.family: "Fira Mono" | ||
175 | 169 | ||
176 | text: shortName | 170 | Text { |
177 | color: "#ffcc66" | 171 | id: dowLabel |
178 | 172 | ||
179 | horizontalAlignment: Text.AlignRight | 173 | anchors.fill: parent |
180 | 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 | } | ||
181 | } | 184 | } |
182 | } | 185 | } |
183 | 186 | ||
@@ -242,8 +245,10 @@ Item { | |||
242 | font.family: "Fira Sans" | 245 | font.family: "Fira Sans" |
243 | font.features: { "tnum": 1 } | 246 | font.features: { "tnum": 1 } |
244 | 247 | ||
248 | property bool today: chrono.date.getFullYear() == model.year && chrono.date.getMonth() == model.month && chrono.date.getDate() == model.day | ||
249 | |||
245 | text: model.day | 250 | text: model.day |
246 | color: model.today ? "#ff6699" : "white" | 251 | color: today ? "#ff6699" : "white" |
247 | 252 | ||
248 | horizontalAlignment: Text.AlignRight | 253 | horizontalAlignment: Text.AlignRight |
249 | verticalAlignment: Text.AlignVCenter | 254 | verticalAlignment: Text.AlignVCenter |