From b9b8aeeea6700d3b108c98cfe30d8206cc1270d7 Mon Sep 17 00:00:00 2001 From: Federico Imberti <66013290+FI-153@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:32:46 +0100 Subject: [PATCH] Only show battery widget settings on MacBooks --- DynamicIsland/Localizable.xcstrings | 2 +- .../components/Settings/SettingsView.swift | 42 ++++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/DynamicIsland/Localizable.xcstrings b/DynamicIsland/Localizable.xcstrings index f098d79..844a1a9 100644 --- a/DynamicIsland/Localizable.xcstrings +++ b/DynamicIsland/Localizable.xcstrings @@ -8243,7 +8243,7 @@ "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." : { diff --git a/DynamicIsland/components/Settings/SettingsView.swift b/DynamicIsland/components/Settings/SettingsView.swift index 7838fef..6e6936e 100644 --- a/DynamicIsland/components/Settings/SettingsView.swift +++ b/DynamicIsland/components/Settings/SettingsView.swift @@ -3228,29 +3228,31 @@ struct LockScreenSettings: View { Text("Enable the weather capsule and configure its layout, provider, units, and optional battery/AQI indicators.") } - Section { - 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")) + if BatteryActivityManager.shared.hasBattery() { + Section { + Defaults.Toggle("Show battery indicator", key: .lockScreenWeatherShowsBatteryGauge) + .settingsHighlight(id: highlightID("Show battery indicator")) - Defaults.Toggle("Show charging status", key: .lockScreenWeatherShowsCharging) - .settingsHighlight(id: highlightID("Show charging status")) - - if lockScreenWeatherShowsCharging { - Defaults.Toggle("Show charging percentage", key: .lockScreenWeatherShowsChargingPercentage) - .settingsHighlight(id: highlightID("Show charging percentage")) + 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) + .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")) } - - Defaults.Toggle("Show Bluetooth battery", key: .lockScreenWeatherShowsBluetooth) - .settingsHighlight(id: highlightID("Show Bluetooth battery")) + } header: { + Text("Battery Widget") + } 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 {