From 27d998edff3c0847f082c9bf8e12da7b7a0518c6 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Fri, 1 Aug 2025 17:48:51 +0800 Subject: TimeDate: dynamic clock icon --- bar/TimeDate.qml | 16 +++++++++------- 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 clock: ['', '', '', '', '', '', '', '', '', '', '', ''] + readonly property var resource: ({ cpu: "", memory: "󰍛", @@ -53,7 +55,7 @@ Singleton { gpu: "󱓞", temp: "", network: network, - clock: "", + clock: clock, calendar: "" }) -- cgit v1.2.3