mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 15:44:32 +00:00
Update HUDs for external display parity
This commit is contained in:
parent
e0da879823
commit
9c044237c1
4 changed files with 100 additions and 34 deletions
|
|
@ -257,22 +257,33 @@ struct ContentView: View {
|
|||
/// Whether the current screen should render as a Dynamic Island pill
|
||||
/// rather than the standard notch shape. Always false on physical notch screens.
|
||||
private var isDynamicIslandMode: Bool {
|
||||
shouldUseDynamicIslandMode(for: vm.screen ?? coordinator.selectedScreen)
|
||||
shouldUseDynamicIslandMode(for: currentScreenName)
|
||||
}
|
||||
|
||||
private var currentScreenName: String {
|
||||
vm.screen ?? coordinator.selectedScreen
|
||||
}
|
||||
|
||||
/// Whether the current screen lacks a physical notch.
|
||||
private var isNonNotchScreen: Bool {
|
||||
let screenName = vm.screen ?? coordinator.selectedScreen
|
||||
guard let screen = NSScreen.screens.first(where: { $0.localizedName == screenName }) else {
|
||||
guard let screen = NSScreen.screens.first(where: { $0.localizedName == currentScreenName }) else {
|
||||
return true
|
||||
}
|
||||
return screen.safeAreaInsets.top <= 0
|
||||
}
|
||||
|
||||
/// Whether the global sneak peek is visible on this specific screen.
|
||||
private var isSneakPeekVisibleOnCurrentScreen: Bool {
|
||||
guard coordinator.sneakPeek.show else { return false }
|
||||
guard Defaults[.showOnAllDisplays] else { return true }
|
||||
guard let targetScreenName = coordinator.sneakPeek.targetScreenName else { return true }
|
||||
return currentScreenName == targetScreenName
|
||||
}
|
||||
|
||||
/// Whether the notch/island should hide off-screen when closed on a non-notch display.
|
||||
/// Temporarily reveals the notch when a sneakPeek HUD (volume, brightness, music, etc.) is active.
|
||||
private var shouldHideUntilHover: Bool {
|
||||
hideNonNotchUntilHover && isNonNotchScreen && vm.notchState == .closed && !coordinator.sneakPeek.show
|
||||
hideNonNotchUntilHover && isNonNotchScreen && vm.notchState == .closed && !isSneakPeekVisibleOnCurrentScreen
|
||||
}
|
||||
|
||||
/// Pill shape for Dynamic Island mode with animated corner radius transitions.
|
||||
|
|
@ -696,7 +707,7 @@ struct ContentView: View {
|
|||
.frame(width: 76, alignment: .trailing)
|
||||
}
|
||||
.frame(height: vm.effectiveClosedNotchHeight + (isHovering ? 8 : 0), alignment: .center)
|
||||
} else if coordinator.sneakPeek.show && Defaults[.inlineHUD] && (coordinator.sneakPeek.type != .music) && (coordinator.sneakPeek.type != .battery) && (coordinator.sneakPeek.type != .timer) && (coordinator.sneakPeek.type != .reminder) && !coordinator.sneakPeek.type.isExtensionPayload && ((coordinator.sneakPeek.type != .volume && coordinator.sneakPeek.type != .brightness && coordinator.sneakPeek.type != .backlight) || vm.notchState == .closed) {
|
||||
} else if isSneakPeekVisibleOnCurrentScreen && Defaults[.inlineHUD] && (coordinator.sneakPeek.type != .music) && (coordinator.sneakPeek.type != .battery) && (coordinator.sneakPeek.type != .timer) && (coordinator.sneakPeek.type != .reminder) && !coordinator.sneakPeek.type.isExtensionPayload && ((coordinator.sneakPeek.type != .volume && coordinator.sneakPeek.type != .brightness && coordinator.sneakPeek.type != .backlight) || vm.notchState == .closed) {
|
||||
InlineHUD(type: $coordinator.sneakPeek.type, value: $coordinator.sneakPeek.value, icon: $coordinator.sneakPeek.icon, hoverAnimation: $isHovering, gestureProgress: $gestureProgress)
|
||||
.transition(
|
||||
coordinator.sneakPeek.type == .capsLock
|
||||
|
|
@ -743,7 +754,7 @@ struct ContentView: View {
|
|||
Rectangle().fill(.clear).frame(width: vm.closedNotchSize.width - 20, height: vm.effectiveClosedNotchHeight)
|
||||
}
|
||||
|
||||
if coordinator.sneakPeek.show {
|
||||
if isSneakPeekVisibleOnCurrentScreen {
|
||||
if (coordinator.sneakPeek.type != .music) && (coordinator.sneakPeek.type != .battery) && (coordinator.sneakPeek.type != .timer) && (coordinator.sneakPeek.type != .reminder) && (coordinator.sneakPeek.type != .capsLock) && !coordinator.sneakPeek.type.isExtensionPayload && !Defaults[.inlineHUD] && ((coordinator.sneakPeek.type != .volume && coordinator.sneakPeek.type != .brightness && coordinator.sneakPeek.type != .backlight) || vm.notchState == .closed) {
|
||||
SystemEventIndicatorModifier(eventType: $coordinator.sneakPeek.type, value: $coordinator.sneakPeek.value, icon: $coordinator.sneakPeek.icon, sendEventBack: { _ in
|
||||
//
|
||||
|
|
@ -1637,7 +1648,7 @@ struct ContentView: View {
|
|||
let shouldFocusTimerTab = enableTimerFeature && timerDisplayMode == .tab && timerManager.isTimerActive && !enableMinimalisticUI
|
||||
|
||||
guard vm.notchState == .closed,
|
||||
!coordinator.sneakPeek.show,
|
||||
!isSneakPeekVisibleOnCurrentScreen,
|
||||
(Defaults[.openNotchOnHover] || shouldFocusTimerTab) else { return }
|
||||
|
||||
hoverTask = Task {
|
||||
|
|
@ -1647,7 +1658,7 @@ struct ContentView: View {
|
|||
await MainActor.run {
|
||||
guard self.vm.notchState == .closed,
|
||||
self.isHovering,
|
||||
!self.coordinator.sneakPeek.show else { return }
|
||||
!self.isSneakPeekVisibleOnCurrentScreen else { return }
|
||||
|
||||
if shouldFocusTimerTab {
|
||||
withAnimation(.smooth) {
|
||||
|
|
@ -2162,7 +2173,7 @@ struct ContentView: View {
|
|||
#endif
|
||||
|
||||
private func shouldFixSizeForSneakPeek() -> Bool {
|
||||
guard coordinator.sneakPeek.show else { return false }
|
||||
guard isSneakPeekVisibleOnCurrentScreen else { return false }
|
||||
let style = resolvedSneakPeekStyle()
|
||||
|
||||
// Check for extension sneak peek
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue