From 37add5008aac280ba05f5e127810707d0430f04a Mon Sep 17 00:00:00 2001 From: Nydragon Date: Wed, 30 Oct 2024 17:26:10 +0100 Subject: [PATCH] feat: add battery status indicator --- src/widgets/battery/Battery.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/widgets/battery/Battery.qml b/src/widgets/battery/Battery.qml index c31e30a..ca90025 100644 --- a/src/widgets/battery/Battery.qml +++ b/src/widgets/battery/Battery.qml @@ -20,6 +20,7 @@ BRectangle { percentage: UPower.displayDevice?.healthPercentage ?? 0 visible: UPower.displayDevice?.healthSupported ?? false } + Pill { id: battery width: parent.width * (!UPower.displayDevice?.healthSupported || 3 / 5) @@ -29,5 +30,19 @@ BRectangle { percentage: UPower.displayDevice?.percentage ?? 0 color: 100 * percentage / 360 } + + Text { + font.pointSize: 25 + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + text: if (UPower.displayDevice?.state === UPowerDeviceState.Charging) + return "󱐋" + else if (UPower.displayDevice?.state === UPowerDeviceState.PendingCharge && !UPower.onBattery) + return "󰚥" + + visible: text + } } }