mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
implemneted new huds system and fixed some bugs
This commit is contained in:
parent
44c053a761
commit
d9d3bc937c
12 changed files with 1515 additions and 263 deletions
|
|
@ -113,6 +113,17 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
modifiers: NSEvent.ModifierFlags
|
||||
) {
|
||||
guard volumeEnabled else { return }
|
||||
|
||||
// Elastic Limit Detection (Vertical HUD)
|
||||
if Defaults[.enableVerticalHUD] {
|
||||
let volume = volumeController.currentVolume
|
||||
if direction == .up && volume >= 0.99 {
|
||||
Task { @MainActor in VerticalHUDWindowManager.shared.triggerBump(direction: 1) }
|
||||
} else if direction == .down && volume <= 0.01 {
|
||||
Task { @MainActor in VerticalHUDWindowManager.shared.triggerBump(direction: -1) }
|
||||
}
|
||||
}
|
||||
|
||||
let baseStep = stepSize(for: step, base: standardVolumeStep)
|
||||
let delta = direction == .up ? baseStep : -baseStep
|
||||
volumeController.adjust(by: delta)
|
||||
|
|
@ -130,6 +141,16 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
isRepeat: Bool,
|
||||
modifiers: NSEvent.ModifierFlags
|
||||
) {
|
||||
// Elastic Limit Detection (Vertical HUD)
|
||||
if Defaults[.enableVerticalHUD] {
|
||||
let brightness = brightnessController.currentBrightness
|
||||
if direction == .up && brightness >= 0.99 {
|
||||
Task { @MainActor in VerticalHUDWindowManager.shared.triggerBump(direction: 1) }
|
||||
} else if direction == .down && brightness <= 0.01 {
|
||||
Task { @MainActor in VerticalHUDWindowManager.shared.triggerBump(direction: -1) }
|
||||
}
|
||||
}
|
||||
|
||||
let baseStep = stepSize(for: step, base: standardBrightnessStep)
|
||||
let delta = direction == .up ? baseStep : -baseStep
|
||||
if modifiers.contains(.command) && keyboardBacklightEnabled {
|
||||
|
|
@ -146,6 +167,22 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
return
|
||||
}
|
||||
|
||||
// Send to Circular HUD if enabled
|
||||
if Defaults[.enableCircularHUD] {
|
||||
Task { @MainActor in
|
||||
CircularHUDWindowManager.shared.show(type: .volume, value: CGFloat(value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Send to Vertical HUD if enabled
|
||||
if Defaults[.enableVerticalHUD] {
|
||||
Task { @MainActor in
|
||||
VerticalHUDWindowManager.shared.show(type: .volume, value: CGFloat(value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Send to custom OSD if enabled
|
||||
if Defaults[.enableCustomOSD] && Defaults[.enableOSDVolume] {
|
||||
Task { @MainActor in
|
||||
|
|
@ -153,8 +190,8 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
// Send to notch HUD if enabled and OSD is not enabled
|
||||
if Defaults[.enableSystemHUD] && !Defaults[.enableCustomOSD] && Defaults[.enableVolumeHUD] {
|
||||
// Send to notch HUD if enabled and OSD/Vertical/Circular is not enabled
|
||||
if Defaults[.enableSystemHUD] && !Defaults[.enableCustomOSD] && !Defaults[.enableVerticalHUD] && !Defaults[.enableCircularHUD] && Defaults[.enableVolumeHUD] {
|
||||
Task { @MainActor in
|
||||
guard let coordinator else { return }
|
||||
coordinator.toggleSneakPeek(
|
||||
|
|
@ -168,6 +205,22 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
}
|
||||
|
||||
private func sendBrightnessNotification(value: Float) {
|
||||
// Send to Circular HUD if enabled
|
||||
if Defaults[.enableCircularHUD] {
|
||||
Task { @MainActor in
|
||||
CircularHUDWindowManager.shared.show(type: .brightness, value: CGFloat(value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Send to Vertical HUD if enabled
|
||||
if Defaults[.enableVerticalHUD] {
|
||||
Task { @MainActor in
|
||||
VerticalHUDWindowManager.shared.show(type: .brightness, value: CGFloat(value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Send to custom OSD if enabled
|
||||
if Defaults[.enableCustomOSD] && Defaults[.enableOSDBrightness] {
|
||||
Task { @MainActor in
|
||||
|
|
@ -175,8 +228,8 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
// Send to notch HUD if enabled and OSD is not enabled
|
||||
if Defaults[.enableSystemHUD] && !Defaults[.enableCustomOSD] && Defaults[.enableBrightnessHUD] {
|
||||
// Send to notch HUD if enabled and OSD/Vertical/Circular is not enabled
|
||||
if Defaults[.enableSystemHUD] && !Defaults[.enableCustomOSD] && !Defaults[.enableVerticalHUD] && !Defaults[.enableCircularHUD] && Defaults[.enableBrightnessHUD] {
|
||||
Task { @MainActor in
|
||||
guard let coordinator else { return }
|
||||
coordinator.toggleSneakPeek(
|
||||
|
|
@ -190,6 +243,22 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
}
|
||||
|
||||
private func sendKeyboardBacklightNotification(value: Float) {
|
||||
// Send to Circular HUD if enabled
|
||||
if Defaults[.enableCircularHUD] {
|
||||
Task { @MainActor in
|
||||
CircularHUDWindowManager.shared.show(type: .backlight, value: CGFloat(value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Send to Vertical HUD if enabled
|
||||
if Defaults[.enableVerticalHUD] {
|
||||
Task { @MainActor in
|
||||
VerticalHUDWindowManager.shared.show(type: .backlight, value: CGFloat(value))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Send to custom OSD if enabled
|
||||
if Defaults[.enableCustomOSD] && Defaults[.enableOSDKeyboardBacklight] {
|
||||
Task { @MainActor in
|
||||
|
|
@ -197,8 +266,8 @@ final class SystemChangesObserver: MediaKeyInterceptorDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
// Send to notch HUD if enabled and OSD is not enabled
|
||||
if Defaults[.enableSystemHUD] && !Defaults[.enableCustomOSD] && Defaults[.enableKeyboardBacklightHUD] {
|
||||
// Send to notch HUD if enabled and OSD/Vertical/Circular is not enabled
|
||||
if Defaults[.enableSystemHUD] && !Defaults[.enableCustomOSD] && !Defaults[.enableVerticalHUD] && !Defaults[.enableCircularHUD] && Defaults[.enableKeyboardBacklightHUD] {
|
||||
Task { @MainActor in
|
||||
guard let coordinator else { return }
|
||||
coordinator.toggleSneakPeek(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue