mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
BatteryService: implement toggleEnabled function
This commit is contained in:
@@ -56,6 +56,18 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function toggleEnabled(enabled) {
|
||||
if (enabled) {
|
||||
setChargingMode(BatteryService.ChargingMode.Full)
|
||||
} else {
|
||||
BatteryService.chargingMode = BatteryService.ChargingMode.Disabled
|
||||
BatteryService.initialSetter = true
|
||||
ToastService.showNotice(I18n.tr("toast.battery-manager.title"), I18n.tr("toast.battery-manager.uninstall-setup"))
|
||||
PanelService.getPanel("batteryPanel")?.toggle(this)
|
||||
uninstallerProcess.running = true
|
||||
}
|
||||
}
|
||||
|
||||
function setChargingMode(newMode) {
|
||||
if (newMode !== BatteryService.ChargingMode.Full && newMode !== BatteryService.ChargingMode.Balanced && newMode !== BatteryService.ChargingMode.Lifespan) {
|
||||
Logger.warn("BatteryService", `Invalid charging mode set ${newMode}`)
|
||||
|
||||
Reference in New Issue
Block a user