mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Working Clipboard
This commit is contained in:
parent
7137fcd255
commit
579c4d3ca6
3 changed files with 17 additions and 4 deletions
|
|
@ -292,15 +292,20 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
|||
// Open the notch if it's closed
|
||||
if viewModel.notchState == .closed {
|
||||
viewModel.open()
|
||||
|
||||
// Wait a bit for the notch to open before toggling clipboard
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
|
||||
self.coordinator.toggleClipboardPopover()
|
||||
}
|
||||
} else {
|
||||
// If notch is already open, toggle immediately
|
||||
self.coordinator.toggleClipboardPopover()
|
||||
}
|
||||
|
||||
// Start clipboard monitoring if not already running
|
||||
if !ClipboardManager.shared.isMonitoring {
|
||||
ClipboardManager.shared.startMonitoring()
|
||||
}
|
||||
|
||||
// Post notification to trigger clipboard popover
|
||||
NotificationCenter.default.post(name: NSNotification.Name("ToggleClipboardPopover"), object: nil)
|
||||
}
|
||||
|
||||
if !Defaults[.showOnAllDisplays] {
|
||||
|
|
|
|||
|
|
@ -213,4 +213,12 @@ class DynamicIslandViewCoordinator: ObservableObject {
|
|||
func showEmpty() {
|
||||
currentView = .home
|
||||
}
|
||||
|
||||
// MARK: - Clipboard Management
|
||||
@Published var shouldToggleClipboardPopover: Bool = false
|
||||
|
||||
func toggleClipboardPopover() {
|
||||
// Toggle the published property to trigger UI updates
|
||||
shouldToggleClipboardPopover.toggle()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ struct DynamicIslandHeader: View {
|
|||
}
|
||||
.foregroundColor(.gray)
|
||||
.environmentObject(vm)
|
||||
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ToggleClipboardPopover"))) { _ in
|
||||
.onChange(of: coordinator.shouldToggleClipboardPopover) { _ in
|
||||
// Only toggle if clipboard is enabled
|
||||
if Defaults[.enableClipboardManager] {
|
||||
showClipboardPopover.toggle()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue