warn on low battery

This commit is contained in:
end-4
2025-05-31 01:38:34 +02:00
parent a3d6f9f07d
commit 42abc57b65
3 changed files with 36 additions and 6 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ Scope {
Layout.alignment: Qt.AlignVCenter
}
Battery {
BatteryIndicator {
visible: (barRoot.useShortenedForm < 2 && UPower.displayDevice.isLaptopBattery)
Layout.alignment: Qt.AlignVCenter
}
@@ -1,5 +1,6 @@
import "root:/modules/common"
import "root:/modules/common/widgets"
import "root:/services"
import QtQuick
import QtQuick.Layouts
import Quickshell
@@ -9,11 +10,11 @@ import Quickshell.Services.UPower
Rectangle {
id: root
property bool borderless: ConfigOptions.bar.borderless
readonly property var chargeState: UPower.displayDevice.state
readonly property bool isCharging: chargeState == UPowerDeviceState.Charging
readonly property bool isPluggedIn: isCharging || chargeState == UPowerDeviceState.PendingCharge
readonly property real percentage: UPower.displayDevice.percentage
readonly property bool isLow: percentage <= ConfigOptions.bar.batteryLowThreshold / 100
readonly property var chargeState: Battery.chargeState
readonly property bool isCharging: Battery.isCharging
readonly property bool isPluggedIn: Battery.isPluggedIn
readonly property real percentage: Battery.percentage
readonly property bool isLow: percentage <= ConfigOptions.battery.low / 100
readonly property color batteryLowBackground: Appearance.m3colors.darkmode ? Appearance.m3colors.m3error : Appearance.m3colors.m3errorContainer
readonly property color batteryLowOnBackground: Appearance.m3colors.darkmode ? Appearance.m3colors.m3errorContainer : Appearance.m3colors.m3error