mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Merge pull request #4 from Ebullioscopic/feature/clipboard
Working Clipboard
This commit is contained in:
commit
36b750070b
3 changed files with 17 additions and 4 deletions
|
|
@ -292,15 +292,20 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||||
// Open the notch if it's closed
|
// Open the notch if it's closed
|
||||||
if viewModel.notchState == .closed {
|
if viewModel.notchState == .closed {
|
||||||
viewModel.open()
|
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
|
// Start clipboard monitoring if not already running
|
||||||
if !ClipboardManager.shared.isMonitoring {
|
if !ClipboardManager.shared.isMonitoring {
|
||||||
ClipboardManager.shared.startMonitoring()
|
ClipboardManager.shared.startMonitoring()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post notification to trigger clipboard popover
|
|
||||||
NotificationCenter.default.post(name: NSNotification.Name("ToggleClipboardPopover"), object: nil)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !Defaults[.showOnAllDisplays] {
|
if !Defaults[.showOnAllDisplays] {
|
||||||
|
|
|
||||||
|
|
@ -213,4 +213,12 @@ class DynamicIslandViewCoordinator: ObservableObject {
|
||||||
func showEmpty() {
|
func showEmpty() {
|
||||||
currentView = .home
|
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)
|
.foregroundColor(.gray)
|
||||||
.environmentObject(vm)
|
.environmentObject(vm)
|
||||||
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("ToggleClipboardPopover"))) { _ in
|
.onChange(of: coordinator.shouldToggleClipboardPopover) { _ in
|
||||||
// Only toggle if clipboard is enabled
|
// Only toggle if clipboard is enabled
|
||||||
if Defaults[.enableClipboardManager] {
|
if Defaults[.enableClipboardManager] {
|
||||||
showClipboardPopover.toggle()
|
showClipboardPopover.toggle()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue