node-mac-recorder 2.22.10 → 2.22.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -50,6 +50,30 @@ static void initializeSafeQueue() {
|
|
|
50
50
|
initializeSafeQueue();
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
+ (BOOL)shouldAllowElectronWindows {
|
|
54
|
+
NSString *flag = [[[NSProcessInfo processInfo] environment] objectForKey:@"CREAVIT_ALLOW_ELECTRON_WINDOWS"];
|
|
55
|
+
if (!flag) return NO;
|
|
56
|
+
|
|
57
|
+
NSString *normalized = [[flag lowercaseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
|
58
|
+
return [normalized isEqualToString:@"1"] ||
|
|
59
|
+
[normalized isEqualToString:@"true"] ||
|
|
60
|
+
[normalized isEqualToString:@"yes"] ||
|
|
61
|
+
[normalized isEqualToString:@"on"];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
+ (BOOL)shouldSkipWindowOwner:(NSString *)appName {
|
|
65
|
+
if (!appName || appName.length == 0) return YES;
|
|
66
|
+
if ([appName containsString:@"WindowServer"] || [appName containsString:@"Dock"]) return YES;
|
|
67
|
+
|
|
68
|
+
if (![self shouldAllowElectronWindows]) {
|
|
69
|
+
if ([appName containsString:@"Electron"] || [appName containsString:@"node"]) {
|
|
70
|
+
return YES;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return NO;
|
|
75
|
+
}
|
|
76
|
+
|
|
53
77
|
+ (BOOL)startRecordingWithPath:(NSString *)outputPath options:(NSDictionary *)options {
|
|
54
78
|
if (@available(macOS 12.3, *)) {
|
|
55
79
|
return [self startRecordingModern:outputPath options:options];
|
|
@@ -432,8 +456,7 @@ static void initializeSafeQueue() {
|
|
|
432
456
|
|
|
433
457
|
NSString *appName = window.owningApplication.applicationName ?: @"Unknown";
|
|
434
458
|
|
|
435
|
-
|
|
436
|
-
if ([appName containsString:@"Electron"] || [appName containsString:@"node"]) continue;
|
|
459
|
+
if ([self shouldSkipWindowOwner:appName]) continue;
|
|
437
460
|
|
|
438
461
|
NSDictionary *windowInfo = @{
|
|
439
462
|
@"id": @(window.windowID),
|
|
@@ -12,6 +12,30 @@ static void initializeWindowQueue() {
|
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
static BOOL ShouldAllowElectronWindows(void) {
|
|
16
|
+
NSString *flag = [[[NSProcessInfo processInfo] environment] objectForKey:@"CREAVIT_ALLOW_ELECTRON_WINDOWS"];
|
|
17
|
+
if (!flag) return NO;
|
|
18
|
+
|
|
19
|
+
NSString *normalized = [[flag lowercaseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
|
20
|
+
return [normalized isEqualToString:@"1"] ||
|
|
21
|
+
[normalized isEqualToString:@"true"] ||
|
|
22
|
+
[normalized isEqualToString:@"yes"] ||
|
|
23
|
+
[normalized isEqualToString:@"on"];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static BOOL ShouldSkipWindowOwner(NSString *appName) {
|
|
27
|
+
if (!appName || appName.length == 0) return YES;
|
|
28
|
+
if ([appName containsString:@"WindowServer"] || [appName containsString:@"Dock"]) return YES;
|
|
29
|
+
|
|
30
|
+
if (!ShouldAllowElectronWindows()) {
|
|
31
|
+
if ([appName containsString:@"Electron"] || [appName containsString:@"node"]) {
|
|
32
|
+
return YES;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return NO;
|
|
37
|
+
}
|
|
38
|
+
|
|
15
39
|
// NAPI Function: Get Windows (Electron-safe)
|
|
16
40
|
Napi::Value GetWindowsElectronSafe(const Napi::CallbackInfo& info) {
|
|
17
41
|
Napi::Env env = info.Env();
|
|
@@ -38,11 +62,7 @@ Napi::Value GetWindowsElectronSafe(const Napi::CallbackInfo& info) {
|
|
|
38
62
|
|
|
39
63
|
NSString *appName = window.owningApplication.applicationName ?: @"Unknown";
|
|
40
64
|
|
|
41
|
-
|
|
42
|
-
if ([appName containsString:@"Electron"] ||
|
|
43
|
-
[appName containsString:@"node"] ||
|
|
44
|
-
[appName containsString:@"WindowServer"] ||
|
|
45
|
-
[appName containsString:@"Dock"]) continue;
|
|
65
|
+
if (ShouldSkipWindowOwner(appName)) continue;
|
|
46
66
|
|
|
47
67
|
NSDictionary *windowInfo = @{
|
|
48
68
|
@"id": @(window.windowID),
|
|
@@ -94,11 +114,7 @@ Napi::Value GetWindowsElectronSafe(const Napi::CallbackInfo& info) {
|
|
|
94
114
|
NSString *appName = (__bridge NSString*)ownerName;
|
|
95
115
|
NSString *windowTitle = windowName ? (__bridge NSString*)windowName : @"";
|
|
96
116
|
|
|
97
|
-
|
|
98
|
-
if ([appName containsString:@"Electron"] ||
|
|
99
|
-
[appName containsString:@"node"] ||
|
|
100
|
-
[appName containsString:@"WindowServer"] ||
|
|
101
|
-
[appName containsString:@"Dock"]) continue;
|
|
117
|
+
if (ShouldSkipWindowOwner(appName)) continue;
|
|
102
118
|
|
|
103
119
|
// Get window bounds
|
|
104
120
|
CGRect bounds = CGRectZero;
|
package/src/window_selector.mm
CHANGED
|
@@ -56,6 +56,31 @@ static id g_screenKeyEventMonitor = nil;
|
|
|
56
56
|
static NSTimer *g_screenTrackingTimer = nil;
|
|
57
57
|
static NSInteger g_currentActiveScreenIndex = -1;
|
|
58
58
|
|
|
59
|
+
static bool shouldAllowElectronWindows() {
|
|
60
|
+
NSString *flag = [[[NSProcessInfo processInfo] environment] objectForKey:@"CREAVIT_ALLOW_ELECTRON_WINDOWS"];
|
|
61
|
+
if (!flag) return false;
|
|
62
|
+
|
|
63
|
+
NSString *normalized = [[flag lowercaseString] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
|
64
|
+
return [normalized isEqualToString:@"1"] ||
|
|
65
|
+
[normalized isEqualToString:@"true"] ||
|
|
66
|
+
[normalized isEqualToString:@"yes"] ||
|
|
67
|
+
[normalized isEqualToString:@"on"];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static bool shouldSkipSelectableWindowOwner(NSString *windowOwner) {
|
|
71
|
+
if (!windowOwner || [windowOwner length] == 0) return true;
|
|
72
|
+
if ([windowOwner isEqualToString:@"WindowServer"]) return true;
|
|
73
|
+
if ([windowOwner isEqualToString:@"Dock"]) return true;
|
|
74
|
+
|
|
75
|
+
if (!shouldAllowElectronWindows()) {
|
|
76
|
+
if ([windowOwner containsString:@"Electron"] || [windowOwner containsString:@"node"]) {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
|
|
59
84
|
// Record icon helpers
|
|
60
85
|
static NSImage *CreateRecordIconImage(CGFloat size) {
|
|
61
86
|
const CGFloat leadingInset = 24.0;
|
|
@@ -757,12 +782,7 @@ NSArray* getAllSelectableWindows() {
|
|
|
757
782
|
|
|
758
783
|
// Skip system windows, dock, menu bar, etc.
|
|
759
784
|
if ([windowLayer intValue] != 0) continue; // Only normal windows
|
|
760
|
-
if (
|
|
761
|
-
if ([windowOwner isEqualToString:@"WindowServer"]) continue;
|
|
762
|
-
if ([windowOwner isEqualToString:@"Dock"]) continue;
|
|
763
|
-
|
|
764
|
-
// Skip Electron windows (our own overlay)
|
|
765
|
-
if ([windowOwner containsString:@"Electron"] || [windowOwner containsString:@"node"]) continue;
|
|
785
|
+
if (shouldSkipSelectableWindowOwner(windowOwner)) continue;
|
|
766
786
|
|
|
767
787
|
// Extract bounds
|
|
768
788
|
int x = [[bounds objectForKey:@"X"] intValue];
|
|
@@ -802,8 +822,7 @@ NSDictionary* getWindowUnderCursor(CGPoint point) {
|
|
|
802
822
|
for (NSDictionary *window in g_allWindows) {
|
|
803
823
|
NSString *appName = [window objectForKey:@"appName"];
|
|
804
824
|
|
|
805
|
-
|
|
806
|
-
if (appName && ([appName containsString:@"Electron"] || [appName containsString:@"node"])) {
|
|
825
|
+
if (shouldSkipSelectableWindowOwner(appName)) {
|
|
807
826
|
continue;
|
|
808
827
|
}
|
|
809
828
|
|