Only show battery widget settings on MacBooks

This commit is contained in:
Federico Imberti 2026-01-06 10:32:46 +01:00
commit b9b8aeeea6
2 changed files with 23 additions and 21 deletions

View file

@ -8243,7 +8243,7 @@
"Enable stats monitoring in Settings to view system performance data." : { "Enable stats monitoring in Settings to view system performance data." : {
}, },
"Enable the battery capsule and configure its layout" : { "Enable the battery capsule and configure its layout." : {
}, },
"Enable the timer feature in Settings to access this tab." : { "Enable the timer feature in Settings to access this tab." : {

View file

@ -3228,29 +3228,31 @@ struct LockScreenSettings: View {
Text("Enable the weather capsule and configure its layout, provider, units, and optional battery/AQI indicators.") Text("Enable the weather capsule and configure its layout, provider, units, and optional battery/AQI indicators.")
} }
Section { if BatteryActivityManager.shared.hasBattery() {
Defaults.Toggle("Show battery indicator", key: .lockScreenWeatherShowsBatteryGauge) Section {
.settingsHighlight(id: highlightID("Show battery indicator")) Defaults.Toggle("Show battery indicator", key: .lockScreenWeatherShowsBatteryGauge)
.settingsHighlight(id: highlightID("Show battery indicator"))
if lockScreenWeatherShowsBatteryGauge {
Defaults.Toggle("Use MacBook icon when on battery", key: .lockScreenWeatherBatteryUsesLaptopSymbol)
.settingsHighlight(id: highlightID("Use MacBook icon when on battery"))
Defaults.Toggle("Show charging status", key: .lockScreenWeatherShowsCharging) if lockScreenWeatherShowsBatteryGauge {
.settingsHighlight(id: highlightID("Show charging status")) Defaults.Toggle("Use MacBook icon when on battery", key: .lockScreenWeatherBatteryUsesLaptopSymbol)
.settingsHighlight(id: highlightID("Use MacBook icon when on battery"))
if lockScreenWeatherShowsCharging {
Defaults.Toggle("Show charging percentage", key: .lockScreenWeatherShowsChargingPercentage) Defaults.Toggle("Show charging status", key: .lockScreenWeatherShowsCharging)
.settingsHighlight(id: highlightID("Show charging percentage")) .settingsHighlight(id: highlightID("Show charging status"))
if lockScreenWeatherShowsCharging {
Defaults.Toggle("Show charging percentage", key: .lockScreenWeatherShowsChargingPercentage)
.settingsHighlight(id: highlightID("Show charging percentage"))
}
Defaults.Toggle("Show Bluetooth battery", key: .lockScreenWeatherShowsBluetooth)
.settingsHighlight(id: highlightID("Show Bluetooth battery"))
} }
} header: {
Defaults.Toggle("Show Bluetooth battery", key: .lockScreenWeatherShowsBluetooth) Text("Battery Widget")
.settingsHighlight(id: highlightID("Show Bluetooth battery")) } footer: {
Text("Enable the battery capsule and configure its layout.")
} }
} header: {
Text("Battery Widget")
} footer: {
Text("Enable the battery capsule and configure its layout.")
} }
Section { Section {