added battery widget on qs

This commit is contained in:
2026-03-13 00:58:44 +00:00
parent ea47a2ca71
commit 64f2e34018

View File

@@ -3,29 +3,21 @@ import QtQuick.Layouts
import Quickshell import Quickshell
import Quickshell.Services.UPower import Quickshell.Services.UPower
Item { RowLayout {
id: root id: content
// enabled: uPowerExists height: 20
width: content.width anchors.centerIn: root
height: content.height Rectangle {
Layout.alignment: Qt.AlignCenter implicitHeight: text.height
RowLayout { implicitWidth: text.width
id: content color: Colors.backgroundAlt
height: 20 Layout.alignment: Qt.AlignCenter
anchors.centerIn: root Text {
Rectangle { id: text
height: text.height property int power: UPower.displayDevice.percentage * 100
width: text.width anchors.centerIn: parent
color: Colors.backgroundAlt text: power + "%"
Layout.alignment: Qt.AlignCenter color: Colors.textPrimary
Text {
property int power: UPower.displayDevice.percentage * 100
id: text
anchors.centerIn: parent
text: power
color: Colors.textPrimary
}
} }
} }
} }