From 4132b13bdc06bfffb5dc4b2256e627f6becf65a2 Mon Sep 17 00:00:00 2001 From: Hariharan Mudaliar Date: Fri, 17 Oct 2025 18:24:35 +0530 Subject: [PATCH] Working with Pulsating --- .../LockScreenLiveActivityOverlay.swift | 8 ++++---- .../LockScreenLiveActivityWindowManager.swift | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/DynamicIsland/components/LockScreen/LockScreenLiveActivityOverlay.swift b/DynamicIsland/components/LockScreen/LockScreenLiveActivityOverlay.swift index 3acdb3a..ace5e30 100644 --- a/DynamicIsland/components/LockScreen/LockScreenLiveActivityOverlay.swift +++ b/DynamicIsland/components/LockScreen/LockScreenLiveActivityOverlay.swift @@ -45,7 +45,7 @@ struct LockScreenLiveActivityOverlay: View { } var body: some View { - HStack(spacing: 0) { + HStack(alignment: .top, spacing: 0) { Color.clear .background { HStack { @@ -62,13 +62,13 @@ struct LockScreenLiveActivityOverlay: View { } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading) } - .frame(width: indicatorSize, height: notchSize.height) + .frame(width: indicatorSize, height: notchSize.height, alignment: .top) Color.clear - .frame(width: notchSize.width, height: notchSize.height) + .frame(width: notchSize.width, height: notchSize.height, alignment: .top) Color.clear - .frame(width: indicatorSize, height: notchSize.height) + .frame(width: indicatorSize, height: notchSize.height, alignment: .top) } .frame(width: baseWidth, height: notchSize.height) .padding(.horizontal, horizontalPadding) diff --git a/DynamicIsland/managers/LockScreenLiveActivityWindowManager.swift b/DynamicIsland/managers/LockScreenLiveActivityWindowManager.swift index e4aaa35..b1fcbbb 100644 --- a/DynamicIsland/managers/LockScreenLiveActivityWindowManager.swift +++ b/DynamicIsland/managers/LockScreenLiveActivityWindowManager.swift @@ -58,6 +58,7 @@ class LockScreenLiveActivityWindowManager { window.level = NSWindow.Level(rawValue: Int(CGShieldingWindowLevel())) window.collectionBehavior = [.canJoinAllSpaces, .stationary, .fullScreenAuxiliary] window.alphaValue = 0 + window.animationBehavior = .none self.window = window self.hasDelegated = false @@ -82,14 +83,25 @@ class LockScreenLiveActivityWindowManager { let overlay = LockScreenLiveActivityOverlay(state: state, notchSize: notchSize) window.contentView = NSHostingView(rootView: overlay) + window.displayIfNeeded() if !hasDelegated { SkyLightOperator.shared.delegateWindow(window) hasDelegated = true } - window.alphaValue = 1 - window.orderFrontRegardless() + if !window.isVisible { + window.alphaValue = 0 + window.orderFrontRegardless() + + NSAnimationContext.runAnimationGroup { context in + context.duration = 0.12 + window.animator().alphaValue = 1 + } + } else { + window.orderFrontRegardless() + window.alphaValue = 1 + } } func showLocked() {