quickshell/modules/Bar/Battery.qml

40 lines
1.1 KiB
QML
Raw Normal View History

import Quickshell
import Quickshell.Services.UPower
import QtQuick
import Quickshell.Widgets
import "../../reusables/"
import "../../"
import "../../settings/"
Loader {
id: batLoader
active: UPower.displayDevice.isLaptopBattery
sourceComponent: Item {
id: root
implicitWidth: batRow.implicitWidth
implicitHeight: Settings.config.barHeight
Rectangle {
id: batRow
implicitWidth: batText.implicitWidth + batIcon.implicitWidth + 10
color: "transparent"
implicitHeight: Settings.config.barHeight
Row {
anchors.centerIn: batRow
CustomText {
id: batText
text: Math.round(UPower.displayDevice.percentage * 100) + "%"
}
IconImage {
id: batIcon
2026-01-16 11:03:15 +01:00
anchors.verticalCenter: parent.verticalCenter
source: Quickshell.iconPath(UPower.displayDevice.iconName)
2026-01-16 11:03:15 +01:00
implicitSize: 12
}
}
}
}
}