Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecac7885dd |
@@ -84,21 +84,26 @@ final class CaptureController: NSObject {
|
|||||||
}
|
}
|
||||||
isSelecting = true
|
isSelecting = true
|
||||||
previousApp = NSWorkspace.shared.frontmostApplication
|
previousApp = NSWorkspace.shared.frontmostApplication
|
||||||
// Activation is async on macOS 26; wait a tick so the app is active
|
// With the event tap driving input we must NOT activate: stealing
|
||||||
// before the overlays appear (otherwise clicks pass through).
|
// focus turns the target app into background mode (dimmed chrome),
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
// and that is what would end up in the screenshot. Activate only on
|
||||||
CaptureController.log("begin: activate issued, active=\(NSApp.isActive)")
|
// the fallback path, where panel events are the only input.
|
||||||
|
let usesTap = AXIsProcessTrusted()
|
||||||
|
if !usesTap {
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
CaptureController.log("begin: usesTap=\(usesTap) active=\(NSApp.isActive)")
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in
|
||||||
guard let self, self.isSelecting else { return }
|
guard let self, self.isSelecting else { return }
|
||||||
CaptureController.log("begin: active=\(NSApp.isActive) — showing overlays")
|
|
||||||
self.overlays = NSScreen.screens.map { screen in
|
self.overlays = NSScreen.screens.map { screen in
|
||||||
let panel = OverlayWindow(screen: screen, controller: self)
|
let panel = OverlayWindow(screen: screen, controller: self)
|
||||||
(panel.contentView as? OverlayView)?.controller = self
|
(panel.contentView as? OverlayView)?.controller = self
|
||||||
return panel
|
return panel
|
||||||
}
|
}
|
||||||
self.overlays.forEach { $0.makeKeyAndOrderFront(nil) }
|
// orderFrontRegardless: show without taking key/focus.
|
||||||
|
self.overlays.forEach { $0.orderFrontRegardless() }
|
||||||
self.overlayIDs = self.overlays.map { $0.windowNumber }
|
self.overlayIDs = self.overlays.map { $0.windowNumber }
|
||||||
CaptureController.log("begin: \(self.overlays.count) overlays, ids=\(self.overlayIDs), active=\(NSApp.isActive)")
|
CaptureController.log("begin: \(self.overlays.count) overlays, ids=\(self.overlayIDs) — prior app stays focused")
|
||||||
self.installEventTap()
|
self.installEventTap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ final class OverlayWindow: NSPanel {
|
|||||||
init(screen: NSScreen, controller: CaptureController) {
|
init(screen: NSScreen, controller: CaptureController) {
|
||||||
let content = OverlayView()
|
let content = OverlayView()
|
||||||
super.init(
|
super.init(
|
||||||
|
// Non-activating: the overlay must NOT steal focus, so the app
|
||||||
|
// being captured keeps its active appearance (undimmed chrome).
|
||||||
|
// Input comes from the CGEventTap, not panel events.
|
||||||
contentRect: screen.frame,
|
contentRect: screen.frame,
|
||||||
styleMask: [.borderless],
|
styleMask: [.borderless, .nonactivatingPanel],
|
||||||
backing: .buffered,
|
backing: .buffered,
|
||||||
defer: false
|
defer: false
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -108,9 +108,9 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
|
|||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>Icon</string>
|
<string>Icon</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>1.8.7</string>
|
<string>1.9.0</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>87</string>
|
<string>90</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user