Add function to determine if the computer has battery

Also the default value for the "showBatteryIndicator" is the result of the function: if the device is a MacBook it defaults to true like before, otherwise to false
This commit is contained in:
Federico Imberti 2025-12-15 16:13:42 +01:00 • committed by Hariharan Mudaliar
commit 712f0e6f88
No known key found for this signature in database
GPG key ID: 025583EB0BE5640E
2 changed files with 9 additions and 1 deletions

View file

@ -483,7 +483,7 @@ extension Defaults.Keys {
// MARK: Battery
static let showPowerStatusNotifications = Key<Bool>("showPowerStatusNotifications", default: true)
static let showBatteryIndicator = Key<Bool>("showBatteryIndicator", default: true)
static let showBatteryIndicator = Key<Bool>("showBatteryIndicator", default: BatteryActivityManager.shared.hasBattery())
static let showBatteryPercentage = Key<Bool>("showBatteryPercentage", default: true)
static let showPowerStatusIcons = Key<Bool>("showPowerStatusIcons", default: true)
static let playLowBatteryAlertSound = Key<Bool>("playLowBatteryAlertSound", default: true)