BatterySerivice: add init function which quietly updates battery treshold

This commit is contained in:
Damian D'Souza
2025-10-09 21:41:21 +02:00
parent 044dbf2b85
commit 33a5cc07d7
+17 -4
View File
@@ -47,21 +47,34 @@ Singleton {
BatteryService.applyChargingMode()
}
function applyChargingMode() {
function applyChargingMode(quiet = false) {
let command = [batteryTresholdScript]
if (quiet) {
command.push("-q")
}
switch (BatteryService.chargingMode) {
case BatteryService.ChargingMode.Full:
chargeLimitProcess.command = [batteryTresholdScript, "100"]
command.push("100")
break
case BatteryService.ChargingMode.Balanced:
chargeLimitProcess.command = [batteryTresholdScript, "80"]
command.push("80")
break
case BatteryService.ChargingMode.Conservative:
chargeLimitProcess.command = [batteryTresholdScript, "60"]
command.push("60")
break
}
chargeLimitProcess.command = command
chargeLimitProcess.running = true
}
function init() {
BatteryService.applyChargingMode(true)
Logger.log("BatteryService", `Applied charging mode - ${BatteryService.chargingMode}`)
}
Process {
id: chargeLimitProcess
workingDirectory: Quickshell.shellDir