Working Screen Assistant with snipping

This commit is contained in:
Hariharan Mudaliar 2025-09-22 00:39:40 +05:30
commit 2f7821f4fd
20 changed files with 4007 additions and 2 deletions

View file

@ -7,6 +7,7 @@
import AppKit
import SwiftUI
import Defaults
class ClipboardPanel: NSPanel {
@ -51,6 +52,10 @@ class ClipboardPanel: NSPanel {
.fullScreenAuxiliary // Float above full-screen apps
]
// Apply screenshot protection
updateScreenshotProtection()
setupScreenshotProtectionObserver()
// Accept mouse moved events for proper hover behavior
acceptsMouseMovedEvents = true
}
@ -134,6 +139,29 @@ class ClipboardPanel: NSPanel {
setFrameOrigin(NSPoint(x: xPosition, y: yPosition))
}
private func setupScreenshotProtectionObserver() {
// Observe changes to hidePanelsFromScreenCapture setting
Defaults.observe(.hidePanelsFromScreenCapture) { [weak self] change in
DispatchQueue.main.async {
self?.updateScreenshotProtection()
}
}
}
private func updateScreenshotProtection() {
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
if shouldHide {
// Exclude from screenshots and screen recordings
self.sharingType = .none
print("🙈 ClipboardPanel: Protected from screenshots and screen recordings")
} else {
// Allow normal screenshot inclusion
self.sharingType = .readOnly
print("👁️ ClipboardPanel: Visible in screenshots and screen recordings")
}
}
}
struct ClipboardPanelView: View {