From 2d878def2803d8ab26ad1ac3cfb6448c2fb8d95e Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 12 Aug 2025 18:24:09 +1000 Subject: lock/fetch: add battery --- modules/lock/Fetch.qml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'modules/lock/Fetch.qml') diff --git a/modules/lock/Fetch.qml b/modules/lock/Fetch.qml index d33ebf1..eed8987 100644 --- a/modules/lock/Fetch.qml +++ b/modules/lock/Fetch.qml @@ -6,6 +6,7 @@ import qs.config import qs.utils import Quickshell import Quickshell.Widgets +import Quickshell.Services.UPower import QtQuick import QtQuick.Layouts @@ -90,7 +91,7 @@ ColumnLayout { Loader { Layout.fillWidth: true asynchronous: true - active: root.height > 200 + active: !batLoader.active && root.height > 200 visible: active sourceComponent: FetchText { @@ -101,7 +102,7 @@ ColumnLayout { Loader { Layout.fillWidth: true asynchronous: true - active: root.height > 110 + active: root.height > (batLoader.active ? 200 : 110) visible: active sourceComponent: FetchText { @@ -116,6 +117,19 @@ ColumnLayout { FetchText { text: `UP : ${SysInfo.uptime}` } + + Loader { + id: batLoader + + Layout.fillWidth: true + asynchronous: true + active: UPower.displayDevice.isLaptopBattery + visible: active + + sourceComponent: FetchText { + text: `BATT: ${UPower.onBattery ? "" : "(+) "}${Math.round(UPower.displayDevice.percentage * 100)}%` + } + } } } -- cgit v1.2.3-freya