mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Create Lock Screen Reminder Widget
This commit is contained in:
parent
00c5774433
commit
436d5a4e96
10 changed files with 465 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ class LockScreenPanelManager {
|
|||
private var collapsedFrame: NSRect?
|
||||
private let collapsedPanelCornerRadius: CGFloat = 28
|
||||
private let expandedPanelCornerRadius: CGFloat = 52
|
||||
private(set) var latestFrame: NSRect?
|
||||
|
||||
private init() {
|
||||
print("[\(timestamp())] LockScreenPanelManager: initialized")
|
||||
|
|
@ -79,6 +80,7 @@ class LockScreenPanelManager {
|
|||
}
|
||||
|
||||
window.setFrame(targetFrame, display: true)
|
||||
latestFrame = targetFrame
|
||||
let hosting = NSHostingView(rootView: LockScreenMusicPanel())
|
||||
hosting.frame = NSRect(origin: .zero, size: targetFrame.size)
|
||||
window.contentView = hosting
|
||||
|
|
@ -123,6 +125,8 @@ class LockScreenPanelManager {
|
|||
window.setFrame(targetFrame, display: true)
|
||||
}
|
||||
|
||||
latestFrame = targetFrame
|
||||
|
||||
// Update corner radius to match the SwiftUI panel's style
|
||||
let targetRadius = expanded ? expandedPanelCornerRadius : collapsedPanelCornerRadius
|
||||
if animated {
|
||||
|
|
@ -146,6 +150,8 @@ class LockScreenPanelManager {
|
|||
window.orderOut(nil)
|
||||
window.contentView = nil
|
||||
|
||||
latestFrame = nil
|
||||
|
||||
print("[\(timestamp())] LockScreenPanelManager: panel hidden")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue