lock/fetch: add battery

This commit is contained in:
2 * r + 2 * t 2025-08-12 18:24:09 +10:00
parent 4b6d7916e6
commit 2d878def28

View file

@ -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)}%`
}
}
}
}