Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Stasis/DefaultsKeys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ import smc_power

extension MagSafeLEDState: Defaults.Serializable {}

enum PercentageDisplayLocation: String, Defaults.Serializable, CaseIterable, Identifiable {
case hidden
case nextToIcon
case insideIcon

var id: String { rawValue }
}

extension Defaults.Keys {
// General
static let launchAtLogin = Key<Bool>("launchAtLogin", default: false)

// Status Icon
static let showBatteryPercentageInStatusIcon = Key<Bool>(
"showBatteryPercentageInStatusIcon", default: false)
static let batteryPercentageDisplayLocation = Key<PercentageDisplayLocation>(
"batteryPercentageDisplayLocation", default: .nextToIcon)
static let showBatteryStateInStatusIcon = Key<Bool>(
"showBatteryStateInStatusIcon", default: true)

Expand Down
69 changes: 14 additions & 55 deletions Stasis/L10n/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -812,33 +812,8 @@
"Discharge the battery to your charge limit when plugged in above the target level." : {

},
"Display the current battery percentage next to the status icon in the menu bar." : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Den aktuellen Batterieprozentsatz neben dem Statussymbol in der Menüleiste anzeigen."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mostrar el porcentaje de batería actual junto al ícono en la barra de menú."
}
},
"es-US" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mostrar el porcentaje de batería actual junto al ícono en la barra de menú."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "メニューバーのステータスアイコンの横にバッテリー残量を表示します。"
}
}
}
"Display battery percentage next to or inside the menu bar icon." : {

},
"Enable heat protection" : {
"localizations" : {
Expand Down Expand Up @@ -1041,6 +1016,12 @@
}
}
}
},
"Hidden" : {

},
"Inside icon" : {

},
"Launch at login" : {
"localizations" : {
Expand Down Expand Up @@ -1265,6 +1246,9 @@
}
}
}
},
"Next to icon" : {

},
"Notifications" : {
"localizations" : {
Expand Down Expand Up @@ -1580,36 +1564,11 @@
}
}
},
"Show battery percentage" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Batterieprozentsatz anzeigen"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mostrar porcentaje de batería"
}
},
"es-US" : {
"stringUnit" : {
"state" : "translated",
"value" : "Mostrar porcentaje de batería"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
"value" : "バッテリー残量を表示"
}
}
}
},
"Show battery state" : {

},
"Show percentage" : {

},
"Sleep Prevention" : {

Expand Down
4 changes: 2 additions & 2 deletions Stasis/StatusBarManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class StatusBarManager {

struct StatusBarContentView: View {
let viewModel: MenuViewModel
@Default(.showBatteryPercentageInStatusIcon) var showPercentage
@Default(.batteryPercentageDisplayLocation) var percentageDisplayLocation
@Default(.showBatteryStateInStatusIcon) var showState

var body: some View {
BatteryIndicatorView(
batteryLevel: viewModel.displayPercentage,
chargingMode: viewModel.chargingMode,
isLowPowerModeEnabled: viewModel.isLowPowerModeEnabled,
showPercentage: showPercentage,
percentageDisplayLocation: percentageDisplayLocation,
showState: showState
)
.fixedSize()
Expand Down
Loading