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 {
id: root
// enabled: uPowerExists
width: content.width
height: content.height
Layout.alignment: Qt.AlignCenter
RowLayout { RowLayout {
id: content id: content
height: 20 height: 20
anchors.centerIn: root anchors.centerIn: root
Rectangle { Rectangle {
height: text.height implicitHeight: text.height
width: text.width implicitWidth: text.width
color: Colors.backgroundAlt color: Colors.backgroundAlt
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Text { Text {
property int power: UPower.displayDevice.percentage * 100
id: text id: text
property int power: UPower.displayDevice.percentage * 100
anchors.centerIn: parent anchors.centerIn: parent
text: power text: power + "%"
color: Colors.textPrimary color: Colors.textPrimary
} }
} }
} }
}