mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
BugFix: Hide Notch from Screen Recordings
This commit is contained in:
parent
c555aa40a6
commit
18f68f56ea
18 changed files with 105 additions and 211 deletions
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
import Defaults
|
||||
|
||||
class ClipboardPanel: NSPanel {
|
||||
|
||||
|
|
@ -51,10 +50,8 @@ class ClipboardPanel: NSPanel {
|
|||
.stationary,
|
||||
.fullScreenAuxiliary // Float above full-screen apps
|
||||
]
|
||||
|
||||
// Apply screenshot protection
|
||||
updateScreenshotProtection()
|
||||
setupScreenshotProtectionObserver()
|
||||
|
||||
ScreenCaptureVisibilityManager.shared.register(self, scope: .panelsOnly)
|
||||
|
||||
// Accept mouse moved events for proper hover behavior
|
||||
acceptsMouseMovedEvents = true
|
||||
|
|
@ -140,28 +137,6 @@ 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 {
|
||||
|
|
|
|||
|
|
@ -93,9 +93,7 @@ class ColorPickerPanel: NSPanel {
|
|||
.fullScreenAuxiliary // Float above full-screen apps
|
||||
]
|
||||
|
||||
// Apply screen capture hiding setting
|
||||
updateScreenCaptureVisibility()
|
||||
setupScreenCaptureObserver()
|
||||
ScreenCaptureVisibilityManager.shared.register(self, scope: .panelsOnly)
|
||||
|
||||
// Accept mouse moved events for proper hover behavior
|
||||
acceptsMouseMovedEvents = true
|
||||
|
|
@ -161,27 +159,8 @@ class ColorPickerPanel: NSPanel {
|
|||
saveCurrentPosition()
|
||||
}
|
||||
|
||||
private func setupScreenCaptureObserver() {
|
||||
// Observe changes to hidePanelsFromScreenCapture setting
|
||||
Defaults.observe(.hidePanelsFromScreenCapture) { [weak self] change in
|
||||
DispatchQueue.main.async {
|
||||
self?.updateScreenCaptureVisibility()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateScreenCaptureVisibility() {
|
||||
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
|
||||
|
||||
if shouldHide {
|
||||
// Hide from screen capture and recording
|
||||
self.sharingType = .none
|
||||
print("🙈 ColorPickerPanel: Hidden from screen capture and recordings")
|
||||
} else {
|
||||
// Allow normal screen capture
|
||||
self.sharingType = .readOnly
|
||||
print("👁️ ColorPickerPanel: Visible in screen capture and recordings")
|
||||
}
|
||||
deinit {
|
||||
ScreenCaptureVisibilityManager.shared.unregister(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ class DynamicIslandWindow: NSPanel {
|
|||
isReleasedWhenClosed = false
|
||||
level = .mainMenu + 3
|
||||
hasShadow = false
|
||||
|
||||
ScreenCaptureVisibilityManager.shared.register(self, scope: .entireInterface)
|
||||
}
|
||||
|
||||
override var canBecomeKey: Bool {
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ class ChatMessagesPanel: NSPanel {
|
|||
.fullScreenAuxiliary
|
||||
]
|
||||
|
||||
// Apply screen capture hiding setting
|
||||
updateScreenCaptureVisibility()
|
||||
setupScreenCaptureObserver()
|
||||
ScreenCaptureVisibilityManager.shared.register(self, scope: .panelsOnly)
|
||||
|
||||
acceptsMouseMovedEvents = true
|
||||
}
|
||||
|
|
@ -78,27 +76,8 @@ class ChatMessagesPanel: NSPanel {
|
|||
setFrameOrigin(NSPoint(x: xPosition, y: yPosition))
|
||||
}
|
||||
|
||||
private func setupScreenCaptureObserver() {
|
||||
// Observe changes to hidePanelsFromScreenCapture setting
|
||||
Defaults.observe(.hidePanelsFromScreenCapture) { [weak self] change in
|
||||
DispatchQueue.main.async {
|
||||
self?.updateScreenCaptureVisibility()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateScreenCaptureVisibility() {
|
||||
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
|
||||
|
||||
if shouldHide {
|
||||
// Hide from screen capture and recording
|
||||
self.sharingType = .none
|
||||
print("🙈 ChatMessagesPanel: Hidden from screen capture and recordings")
|
||||
} else {
|
||||
// Allow normal screen capture
|
||||
self.sharingType = .readOnly
|
||||
print("👁️ ChatMessagesPanel: Visible in screen capture and recordings")
|
||||
}
|
||||
deinit {
|
||||
ScreenCaptureVisibilityManager.shared.unregister(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -152,9 +131,7 @@ class ChatInputPanel: NSPanel {
|
|||
.fullScreenAuxiliary
|
||||
]
|
||||
|
||||
// Apply screen capture hiding setting
|
||||
updateScreenCaptureVisibility()
|
||||
setupScreenCaptureObserver()
|
||||
ScreenCaptureVisibilityManager.shared.register(self, scope: .panelsOnly)
|
||||
|
||||
acceptsMouseMovedEvents = true
|
||||
}
|
||||
|
|
@ -183,27 +160,8 @@ class ChatInputPanel: NSPanel {
|
|||
setFrameOrigin(NSPoint(x: xPosition, y: yPosition))
|
||||
}
|
||||
|
||||
private func setupScreenCaptureObserver() {
|
||||
// Observe changes to hidePanelsFromScreenCapture setting
|
||||
Defaults.observe(.hidePanelsFromScreenCapture) { [weak self] change in
|
||||
DispatchQueue.main.async {
|
||||
self?.updateScreenCaptureVisibility()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateScreenCaptureVisibility() {
|
||||
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
|
||||
|
||||
if shouldHide {
|
||||
// Hide from screen capture and recording
|
||||
self.sharingType = .none
|
||||
print("🙈 ChatInputPanel: Hidden from screen capture and recordings")
|
||||
} else {
|
||||
// Allow normal screen capture
|
||||
self.sharingType = .readOnly
|
||||
print("👁️ ChatInputPanel: Visible in screen capture and recordings")
|
||||
}
|
||||
deinit {
|
||||
ScreenCaptureVisibilityManager.shared.unregister(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -786,45 +744,23 @@ struct ScreenshotPopoverBackground: NSViewRepresentable {
|
|||
func makeNSView(context: Context) -> NSView {
|
||||
let view = NSView()
|
||||
|
||||
// Apply screen capture protection like our other panels
|
||||
DispatchQueue.main.async {
|
||||
if let window = view.window {
|
||||
self.updateScreenCaptureVisibility(window: window)
|
||||
self.setupScreenCaptureObserver(window: window)
|
||||
}
|
||||
guard let window = view.window else { return }
|
||||
ScreenCaptureVisibilityManager.shared.register(window, scope: .panelsOnly)
|
||||
}
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
func updateNSView(_ nsView: NSView, context: Context) {
|
||||
// Update screen capture protection when view updates
|
||||
if let window = nsView.window {
|
||||
updateScreenCaptureVisibility(window: window)
|
||||
ScreenCaptureVisibilityManager.shared.register(window, scope: .panelsOnly)
|
||||
}
|
||||
}
|
||||
|
||||
private func updateScreenCaptureVisibility(window: NSWindow) {
|
||||
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
|
||||
|
||||
if shouldHide {
|
||||
// Hide from screen capture and recording
|
||||
window.sharingType = .none
|
||||
print("🙈 ScreenshotPopover: Hidden from screen capture and recordings")
|
||||
} else {
|
||||
// Allow normal screen capture
|
||||
window.sharingType = .readOnly
|
||||
print("👁️ ScreenshotPopover: Visible in screen capture and recordings")
|
||||
}
|
||||
}
|
||||
|
||||
private func setupScreenCaptureObserver(window: NSWindow) {
|
||||
// Observe changes to hidePanelsFromScreenCapture setting
|
||||
Defaults.observe(.hidePanelsFromScreenCapture) { [weak window] change in
|
||||
DispatchQueue.main.async {
|
||||
guard let window = window else { return }
|
||||
self.updateScreenCaptureVisibility(window: window)
|
||||
}
|
||||
static func dismantleNSView(_ nsView: NSView, coordinator: ()) {
|
||||
if let window = nsView.window {
|
||||
ScreenCaptureVisibilityManager.shared.unregister(window)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -58,9 +58,7 @@ class ModelSelectionPanel: NSPanel {
|
|||
.fullScreenAuxiliary
|
||||
]
|
||||
|
||||
// Apply screen capture hiding setting
|
||||
updateScreenCaptureVisibility()
|
||||
setupScreenCaptureObserver()
|
||||
ScreenCaptureVisibilityManager.shared.register(self, scope: .panelsOnly)
|
||||
|
||||
acceptsMouseMovedEvents = true
|
||||
}
|
||||
|
|
@ -89,27 +87,8 @@ class ModelSelectionPanel: NSPanel {
|
|||
setFrameOrigin(NSPoint(x: xPosition, y: yPosition))
|
||||
}
|
||||
|
||||
private func setupScreenCaptureObserver() {
|
||||
// Observe changes to hidePanelsFromScreenCapture setting
|
||||
Defaults.observe(.hidePanelsFromScreenCapture) { [weak self] change in
|
||||
DispatchQueue.main.async {
|
||||
self?.updateScreenCaptureVisibility()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateScreenCaptureVisibility() {
|
||||
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
|
||||
|
||||
if shouldHide {
|
||||
// Hide from screen capture and recording
|
||||
self.sharingType = .none
|
||||
print("🙈 ModelSelectionPanel: Hidden from screen capture and recordings")
|
||||
} else {
|
||||
// Allow normal screen capture
|
||||
self.sharingType = .readOnly
|
||||
print("👁️ ModelSelectionPanel: Visible in screen capture and recordings")
|
||||
}
|
||||
deinit {
|
||||
ScreenCaptureVisibilityManager.shared.unregister(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ class ScreenAssistantPanel: NSPanel {
|
|||
.fullScreenAuxiliary
|
||||
]
|
||||
|
||||
// Apply screen capture hiding setting
|
||||
updateScreenCaptureVisibility()
|
||||
setupScreenCaptureObserver()
|
||||
ScreenCaptureVisibilityManager.shared.register(self, scope: .panelsOnly)
|
||||
|
||||
// Set minimal size since this is just a wrapper
|
||||
setContentSize(CGSize(width: 1, height: 1))
|
||||
|
|
@ -77,27 +75,8 @@ class ScreenAssistantPanel: NSPanel {
|
|||
super.close()
|
||||
}
|
||||
|
||||
private func setupScreenCaptureObserver() {
|
||||
// Observe changes to hidePanelsFromScreenCapture setting
|
||||
Defaults.observe(.hidePanelsFromScreenCapture) { [weak self] change in
|
||||
DispatchQueue.main.async {
|
||||
self?.updateScreenCaptureVisibility()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateScreenCaptureVisibility() {
|
||||
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
|
||||
|
||||
if shouldHide {
|
||||
// Hide from screen capture and recording
|
||||
self.sharingType = .none
|
||||
print("🙈 ScreenAssistantPanel: Hidden from screen capture and recordings")
|
||||
} else {
|
||||
// Allow normal screen capture
|
||||
self.sharingType = .readOnly
|
||||
print("👁️ ScreenAssistantPanel: Visible in screen capture and recordings")
|
||||
}
|
||||
deinit {
|
||||
ScreenCaptureVisibilityManager.shared.unregister(self)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ struct GeneralSettings: View {
|
|||
NotificationCenter.default.post(name: Notification.Name.automaticallySwitchDisplayChanged, object: nil)
|
||||
}
|
||||
.disabled(showOnAllDisplays)
|
||||
Defaults.Toggle("Hide panels from screenshots & screen recordings", key: .hidePanelsFromScreenCapture)
|
||||
Defaults.Toggle("Hide Dynamic Island during screenshots & recordings", key: .hideDynamicIslandFromScreenCapture)
|
||||
} header: {
|
||||
Text("System features")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import AppKit
|
||||
import SwiftUI
|
||||
import Defaults
|
||||
import Sparkle
|
||||
|
||||
class SettingsWindowController: NSWindowController {
|
||||
|
|
@ -65,9 +64,7 @@ class SettingsWindowController: NSWindowController {
|
|||
// Handle window closing
|
||||
window.delegate = self
|
||||
|
||||
// Apply screen capture hiding setting
|
||||
updateScreenCaptureVisibility()
|
||||
setupScreenCaptureObserver()
|
||||
ScreenCaptureVisibilityManager.shared.register(window, scope: .panelsOnly)
|
||||
}
|
||||
|
||||
func showWindow() {
|
||||
|
|
@ -108,26 +105,9 @@ class SettingsWindowController: NSWindowController {
|
|||
NSApp.setActivationPolicy(.accessory)
|
||||
}
|
||||
|
||||
private func setupScreenCaptureObserver() {
|
||||
// Observe changes to hidePanelsFromScreenCapture setting
|
||||
Defaults.observe(.hidePanelsFromScreenCapture) { [weak self] change in
|
||||
DispatchQueue.main.async {
|
||||
self?.updateScreenCaptureVisibility()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func updateScreenCaptureVisibility() {
|
||||
let shouldHide = Defaults[.hidePanelsFromScreenCapture]
|
||||
|
||||
if shouldHide {
|
||||
// Hide from screen capture and recording
|
||||
window?.sharingType = .none
|
||||
print("🙈 SettingsWindow: Hidden from screen capture and recordings")
|
||||
} else {
|
||||
// Allow normal screen capture
|
||||
window?.sharingType = .readOnly
|
||||
print("👁️ SettingsWindow: Visible in screen capture and recordings")
|
||||
deinit {
|
||||
if let window = window {
|
||||
ScreenCaptureVisibilityManager.shared.unregister(window)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue