diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-01 17:48:51 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-01 17:48:51 +0800 |
| commit | 27d998edff3c0847f082c9bf8e12da7b7a0518c6 (patch) | |
| tree | 096735098285c6999ccbf5c3933669964c918548 | |
| parent | a657eab0468ef86b398e1612c2a3d5caf7328f1e (diff) | |
TimeDate: dynamic clock icon
| -rw-r--r-- | bar/TimeDate.qml | 16 | ||||
| -rw-r--r-- | config/Icons.qml | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/bar/TimeDate.qml b/bar/TimeDate.qml index a7a1552..8e554ef 100644 --- a/bar/TimeDate.qml +++ b/bar/TimeDate.qml @@ -35,6 +35,11 @@ Item { sourceComponent: !root.isAlt ? main : alt readonly property Component main: Component { RowLayout { + id: root + property int h: Services.TimeDate.hours + property int m: Services.TimeDate.minutes + property int s: Services.TimeDate.seconds + Item { Layout.fillWidth: true } @@ -42,31 +47,28 @@ Item { spacing: Bar.resourceIconTextSpacing Icon { - text: Icons.resource.clock + text: Icons.resource.clock[root.h - 1] font.pixelSize: Style.font.size.larger } RowLayout { - property int h: Services.TimeDate.hours - property int m: Services.TimeDate.minutes - property int s: Services.TimeDate.seconds spacing: 0 IText { animate: true - text: (parent.h >= 10 ? "" : "0") + parent.h + text: (root.h >= 10 ? "" : "0") + root.h } IText { text: ":" } IText { animate: true - text: (parent.m >= 10 ? "" : "0") + parent.m + text: (root.m >= 10 ? "" : "0") + root.m } IText { text: ":" } IText { animate: true - text: (parent.s >= 10 ? "" : "0") + parent.s + text: (root.s >= 10 ? "" : "0") + root.s renderType: Text.CurveRendering // it's not static and is rapidly updated } } diff --git a/config/Icons.qml b/config/Icons.qml index 9720463..240be6b 100644 --- a/config/Icons.qml +++ b/config/Icons.qml @@ -46,6 +46,8 @@ Singleton { wifi: wifi }) + readonly property list<string> clock: ['', '', '', '', '', '', '', '', '', '', '', ''] + readonly property var resource: ({ cpu: "", memory: "", @@ -53,7 +55,7 @@ Singleton { gpu: "", temp: "", network: network, - clock: "", + clock: clock, calendar: "" }) |
