Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69e1a7fccb | ||
|
|
e22bcb99c4 | ||
|
|
457e303152 | ||
|
|
345f306edf |
@@ -10,10 +10,21 @@ final class CaptureController: NSObject {
|
|||||||
private var previousApp: NSRunningApplication?
|
private var previousApp: NSRunningApplication?
|
||||||
private var overlayIDs: [Int] = []
|
private var overlayIDs: [Int] = []
|
||||||
|
|
||||||
|
/// Session event log for debugging (dumped via Copy Diagnostics).
|
||||||
|
static var sessionLog: [String] = []
|
||||||
|
static func log(_ line: String) {
|
||||||
|
sessionLog.append(line)
|
||||||
|
if sessionLog.count > 100 { sessionLog.removeFirst() }
|
||||||
|
NSLog("[Kapture] \(line)")
|
||||||
|
}
|
||||||
|
|
||||||
/// Diagnostic snapshot for "Copy Diagnostics" menu item.
|
/// Diagnostic snapshot for "Copy Diagnostics" menu item.
|
||||||
func diagnostics() -> String {
|
func diagnostics() -> String {
|
||||||
var lines: [String] = []
|
var lines: [String] = []
|
||||||
lines.append("Kapture diagnostics")
|
lines.append("Kapture diagnostics — version \(Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "?")")
|
||||||
|
lines.append("--- session log (newest last) ---")
|
||||||
|
lines.append(contentsOf: Self.sessionLog)
|
||||||
|
lines.append("--- screens ---")
|
||||||
for (i, s) in NSScreen.screens.enumerated() {
|
for (i, s) in NSScreen.screens.enumerated() {
|
||||||
let scale = s.backingScaleFactor
|
let scale = s.backingScaleFactor
|
||||||
let cgID = (s.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? NSNumber)?.uint32Value ?? 0
|
let cgID = (s.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? NSNumber)?.uint32Value ?? 0
|
||||||
@@ -50,21 +61,26 @@ final class CaptureController: NSObject {
|
|||||||
}
|
}
|
||||||
isSelecting = true
|
isSelecting = true
|
||||||
previousApp = NSWorkspace.shared.frontmostApplication
|
previousApp = NSWorkspace.shared.frontmostApplication
|
||||||
if #available(macOS 14.0, *) {
|
// Activation is ASYNC: isActive only flips on a later runloop tick
|
||||||
NSApp.activate()
|
// (verified on macOS 26). Show overlays only once active, otherwise
|
||||||
} else {
|
// the first click can pass through to the windows below.
|
||||||
NSApp.activate(ignoringOtherApps: true)
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
CaptureController.log("begin: activate issued, active=\(NSApp.isActive)")
|
||||||
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in
|
||||||
|
guard let self, self.isSelecting else { return }
|
||||||
|
CaptureController.log("begin: active=\(NSApp.isActive) — showing overlays")
|
||||||
|
self.overlays = NSScreen.screens.map { screen in
|
||||||
|
OverlayWindow(
|
||||||
|
screen: screen,
|
||||||
|
onComplete: { [weak self] rect in self?.finishSelection(rect) },
|
||||||
|
onCancel: { [weak self] in self?.cancelSelection() },
|
||||||
|
onWindowPick: { [weak self] rect in self?.finishWindowPick(rect) }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
self.overlays.forEach { $0.makeKeyAndOrderFront(nil) }
|
||||||
|
self.overlayIDs = self.overlays.map { $0.windowNumber }
|
||||||
|
CaptureController.log("begin: \(self.overlays.count) overlays, ids=\(self.overlayIDs), active=\(NSApp.isActive)")
|
||||||
}
|
}
|
||||||
overlays = NSScreen.screens.map { screen in
|
|
||||||
OverlayWindow(
|
|
||||||
screen: screen,
|
|
||||||
onComplete: { [weak self] rect in self?.finishSelection(rect) },
|
|
||||||
onCancel: { [weak self] in self?.cancelSelection() },
|
|
||||||
onWindowPick: { [weak self] rect in self?.finishWindowPick(rect) }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
overlays.forEach { $0.makeKeyAndOrderFront(nil) }
|
|
||||||
overlayIDs = overlays.map { $0.windowNumber }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A window was picked from hover — capture it with rounded corners.
|
/// A window was picked from hover — capture it with rounded corners.
|
||||||
|
|||||||
+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.6.0</string>
|
<string>1.6.4</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>60</string>
|
<string>64</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHighResolutionCapable</key>
|
<key>NSHighResolutionCapable</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user