mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Fix: Individual disable HUDs
This commit is contained in:
parent
eb5d0d42d9
commit
2f22e27902
3 changed files with 48 additions and 13 deletions
|
|
@ -1302,6 +1302,9 @@ private struct HUDAndOSDSettingsView: View {
|
||||||
@Default(.enableVerticalHUD) var enableVerticalHUD
|
@Default(.enableVerticalHUD) var enableVerticalHUD
|
||||||
@Default(.enableCircularHUD) var enableCircularHUD
|
@Default(.enableCircularHUD) var enableCircularHUD
|
||||||
@Default(.verticalHUDPosition) var verticalHUDPosition
|
@Default(.verticalHUDPosition) var verticalHUDPosition
|
||||||
|
@Default(.enableVolumeHUD) var enableVolumeHUD
|
||||||
|
@Default(.enableBrightnessHUD) var enableBrightnessHUD
|
||||||
|
@Default(.enableKeyboardBacklightHUD) var enableKeyboardBacklightHUD
|
||||||
|
|
||||||
// Vertical HUD Props
|
// Vertical HUD Props
|
||||||
@Default(.verticalHUDShowValue) var verticalHUDShowValue
|
@Default(.verticalHUDShowValue) var verticalHUDShowValue
|
||||||
|
|
@ -1531,6 +1534,20 @@ private struct HUDAndOSDSettingsView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if accessibilityPermission.isAuthorized {
|
||||||
|
Section {
|
||||||
|
Toggle("Volume HUD", isOn: $enableVolumeHUD)
|
||||||
|
Toggle("Brightness HUD", isOn: $enableBrightnessHUD)
|
||||||
|
Toggle("Keyboard Backlight HUD", isOn: $enableKeyboardBacklightHUD)
|
||||||
|
} header: {
|
||||||
|
Text("Controls")
|
||||||
|
} footer: {
|
||||||
|
Text("Choose which system controls should display HUD notifications.")
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.font(.caption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
Toggle("Show Percentage", isOn: $verticalHUDShowValue)
|
Toggle("Show Percentage", isOn: $verticalHUDShowValue)
|
||||||
Toggle("Use Accent Color", isOn: $verticalHUDUseAccentColor)
|
Toggle("Use Accent Color", isOn: $verticalHUDUseAccentColor)
|
||||||
|
|
@ -1599,6 +1616,20 @@ private struct HUDAndOSDSettingsView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if accessibilityPermission.isAuthorized {
|
||||||
|
Section {
|
||||||
|
Toggle("Volume HUD", isOn: $enableVolumeHUD)
|
||||||
|
Toggle("Brightness HUD", isOn: $enableBrightnessHUD)
|
||||||
|
Toggle("Keyboard Backlight HUD", isOn: $enableKeyboardBacklightHUD)
|
||||||
|
} header: {
|
||||||
|
Text("Controls")
|
||||||
|
} footer: {
|
||||||
|
Text("Choose which system controls should display HUD notifications.")
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.font(.caption)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
Toggle("Show Percentage", isOn: $circularHUDShowValue)
|
Toggle("Show Percentage", isOn: $circularHUDShowValue)
|
||||||
Toggle("Use Accent Color", isOn: $circularHUDUseAccentColor)
|
Toggle("Use Accent Color", isOn: $circularHUDUseAccentColor)
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to Circular HUD if enabled
|
// Send to Circular HUD if enabled
|
||||||
if Defaults[.enableCircularHUD] {
|
if Defaults[.enableCircularHUD] && Defaults[.enableVolumeHUD] {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
CircularHUDWindowManager.shared.show(type: .volume, value: CGFloat(value))
|
CircularHUDWindowManager.shared.show(type: .volume, value: CGFloat(value))
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to Vertical HUD if enabled
|
// Send to Vertical HUD if enabled
|
||||||
if Defaults[.enableVerticalHUD] {
|
if Defaults[.enableVerticalHUD] && Defaults[.enableVolumeHUD] {
|
||||||
let icon = resolvedVolumeIcon(isMuted: isMuted)
|
let icon = resolvedVolumeIcon(isMuted: isMuted)
|
||||||
VerticalHUDWindowManager.shared.show(type: .volume, value: CGFloat(value), icon: icon)
|
VerticalHUDWindowManager.shared.show(type: .volume, value: CGFloat(value), icon: icon)
|
||||||
return
|
return
|
||||||
|
|
@ -228,7 +228,7 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
||||||
|
|
||||||
private func sendBrightnessNotification(value: Float) {
|
private func sendBrightnessNotification(value: Float) {
|
||||||
// Send to Circular HUD if enabled
|
// Send to Circular HUD if enabled
|
||||||
if Defaults[.enableCircularHUD] {
|
if Defaults[.enableCircularHUD] && Defaults[.enableBrightnessHUD] {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
CircularHUDWindowManager.shared.show(type: .brightness, value: CGFloat(value))
|
CircularHUDWindowManager.shared.show(type: .brightness, value: CGFloat(value))
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +236,7 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to Vertical HUD if enabled
|
// Send to Vertical HUD if enabled
|
||||||
if Defaults[.enableVerticalHUD] {
|
if Defaults[.enableVerticalHUD] && Defaults[.enableBrightnessHUD] {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
VerticalHUDWindowManager.shared.show(type: .brightness, value: CGFloat(value))
|
VerticalHUDWindowManager.shared.show(type: .brightness, value: CGFloat(value))
|
||||||
}
|
}
|
||||||
|
|
@ -266,7 +266,7 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
||||||
|
|
||||||
private func sendKeyboardBacklightNotification(value: Float) {
|
private func sendKeyboardBacklightNotification(value: Float) {
|
||||||
// Send to Circular HUD if enabled
|
// Send to Circular HUD if enabled
|
||||||
if Defaults[.enableCircularHUD] {
|
if Defaults[.enableCircularHUD] && Defaults[.enableKeyboardBacklightHUD] {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
CircularHUDWindowManager.shared.show(type: .backlight, value: CGFloat(value))
|
CircularHUDWindowManager.shared.show(type: .backlight, value: CGFloat(value))
|
||||||
}
|
}
|
||||||
|
|
@ -274,7 +274,7 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to Vertical HUD if enabled
|
// Send to Vertical HUD if enabled
|
||||||
if Defaults[.enableVerticalHUD] {
|
if Defaults[.enableVerticalHUD] && Defaults[.enableKeyboardBacklightHUD] {
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
VerticalHUDWindowManager.shared.show(type: .backlight, value: CGFloat(value))
|
VerticalHUDWindowManager.shared.show(type: .backlight, value: CGFloat(value))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ class SystemHUDManager {
|
||||||
|
|
||||||
// Observe individual HUD toggles
|
// Observe individual HUD toggles
|
||||||
Defaults.publisher(.enableVolumeHUD, options: []).sink { [weak self] change in
|
Defaults.publisher(.enableVolumeHUD, options: []).sink { [weak self] change in
|
||||||
guard let self = self, self.isSetupComplete, Defaults[.enableSystemHUD] else {
|
guard let self = self, self.isSetupComplete, self.requiresSystemToggleHandling else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.changesObserver?.update(
|
self.changesObserver?.update(
|
||||||
|
|
@ -109,7 +109,7 @@ class SystemHUDManager {
|
||||||
}.store(in: &cancellables)
|
}.store(in: &cancellables)
|
||||||
|
|
||||||
Defaults.publisher(.enableBrightnessHUD, options: []).sink { [weak self] change in
|
Defaults.publisher(.enableBrightnessHUD, options: []).sink { [weak self] change in
|
||||||
guard let self = self, self.isSetupComplete, Defaults[.enableSystemHUD] else {
|
guard let self = self, self.isSetupComplete, self.requiresSystemToggleHandling else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.changesObserver?.update(
|
self.changesObserver?.update(
|
||||||
|
|
@ -120,7 +120,7 @@ class SystemHUDManager {
|
||||||
}.store(in: &cancellables)
|
}.store(in: &cancellables)
|
||||||
|
|
||||||
Defaults.publisher(.enableKeyboardBacklightHUD, options: []).sink { [weak self] change in
|
Defaults.publisher(.enableKeyboardBacklightHUD, options: []).sink { [weak self] change in
|
||||||
guard let self = self, self.isSetupComplete, Defaults[.enableSystemHUD] else {
|
guard let self = self, self.isSetupComplete, self.requiresSystemToggleHandling else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
self.changesObserver?.update(
|
self.changesObserver?.update(
|
||||||
|
|
@ -167,6 +167,10 @@ class SystemHUDManager {
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
|
private var requiresSystemToggleHandling: Bool {
|
||||||
|
Defaults[.enableSystemHUD] || Defaults[.enableVerticalHUD] || Defaults[.enableCircularHUD]
|
||||||
|
}
|
||||||
|
|
||||||
/// Public property to check if system operations are in progress
|
/// Public property to check if system operations are in progress
|
||||||
var isOperationInProgress: Bool {
|
var isOperationInProgress: Bool {
|
||||||
return isSystemOperationInProgress
|
return isSystemOperationInProgress
|
||||||
|
|
@ -206,10 +210,10 @@ class SystemHUDManager {
|
||||||
let keyboardBacklightEnabled: Bool
|
let keyboardBacklightEnabled: Bool
|
||||||
|
|
||||||
if Defaults[.enableCircularHUD] || Defaults[.enableVerticalHUD] {
|
if Defaults[.enableCircularHUD] || Defaults[.enableVerticalHUD] {
|
||||||
// Vertical and Circular HUD support all events
|
// Respect per-control toggles so the system HUD can handle disabled events
|
||||||
volumeEnabled = true
|
volumeEnabled = Defaults[.enableVolumeHUD]
|
||||||
brightnessEnabled = true
|
brightnessEnabled = Defaults[.enableBrightnessHUD]
|
||||||
keyboardBacklightEnabled = true
|
keyboardBacklightEnabled = Defaults[.enableKeyboardBacklightHUD]
|
||||||
} else if Defaults[.enableCustomOSD] {
|
} else if Defaults[.enableCustomOSD] {
|
||||||
volumeEnabled = Defaults[.enableOSDVolume]
|
volumeEnabled = Defaults[.enableOSDVolume]
|
||||||
brightnessEnabled = Defaults[.enableOSDBrightness]
|
brightnessEnabled = Defaults[.enableOSDBrightness]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue