From a7cc075664a3a969371161bf01cf8caea777d0b3 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Mon, 13 Jan 2025 07:07:13 +0400 Subject: [PATCH] basic battery percentage for now --- config/quickshell/Battery.qml | 10 ++++++++++ config/quickshell/shell.qml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/quickshell/Battery.qml b/config/quickshell/Battery.qml index eb5a764e..d376150b 100644 --- a/config/quickshell/Battery.qml +++ b/config/quickshell/Battery.qml @@ -4,4 +4,14 @@ import Quickshell.Services.UPower Item { id: battery + readonly property var chargeState: UPower.displayDevice.state + readonly property bool isCharging: chargeState == UPowerDeviceState.Charging; + readonly property bool isPluggedIn: isCharging || chargeState == UPowerDeviceState.PendingCharge; + readonly property real percentage: UPower.displayDevice.percentage + readonly property bool isLow: percentage <= 0.2 + + Text { + color: "#FFFFFF" + text: percentage + } } diff --git a/config/quickshell/shell.qml b/config/quickshell/shell.qml index ea9dd8fe..acdd4ccf 100644 --- a/config/quickshell/shell.qml +++ b/config/quickshell/shell.qml @@ -74,7 +74,7 @@ ShellRoot { ColumnLayout { anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter - /* spacing: 5 */ + spacing: 15 Tray {} Battery { }