battery-wid

This commit is contained in:
Zacharias-Brohn
2026-02-11 15:51:30 +01:00
parent faec46e033
commit 8c2a2dac34
6 changed files with 58 additions and 13 deletions
+7
View File
@@ -9,6 +9,7 @@ import qs.Config
import qs.Helpers
import qs.Daemons
import qs.Modules.Polkit
import qs.Modules.UPower
RowLayout {
id: root
@@ -160,6 +161,12 @@ RowLayout {
}
}
}
DelegateChoice {
roleValue: "upower"
delegate: WrappedLoader {
sourceComponent: UPowerWidget {}
}
}
}
}
+26
View File
@@ -0,0 +1,26 @@
import Quickshell
import QtQuick
import qs.Components
import qs.Config
import qs.Helpers
import qs.Modules
Item {
id: root
implicitWidth: 100
anchors.top: parent.top
anchors.bottom: parent.bottom
function findDevice() {
for ( let i = 0; i < UPower.devices.count; i++ ) {
if ( UPower.devices[i].isLaptopBattery ) {
return UPower.devices[i];
}
}
}
CustomText {
text: findDevice().percentage
}
}