node-mac-recorder 2.10.3 → 2.10.5
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 +1 -1
- package/src/window_selector.mm +54 -19
package/package.json
CHANGED
package/src/window_selector.mm
CHANGED
|
@@ -16,7 +16,7 @@ static NSTimer *g_trackingTimer = nil;
|
|
|
16
16
|
static NSDictionary *g_selectedWindowInfo = nil;
|
|
17
17
|
static NSMutableArray *g_allWindows = nil;
|
|
18
18
|
static NSDictionary *g_currentWindowUnderCursor = nil;
|
|
19
|
-
static bool g_bringToFrontEnabled =
|
|
19
|
+
static bool g_bringToFrontEnabled = false; // Default disabled for overlay-only highlighting
|
|
20
20
|
static id g_windowKeyEventMonitor = nil;
|
|
21
21
|
|
|
22
22
|
// Recording preview overlay state
|
|
@@ -54,6 +54,7 @@ void updateScreenOverlays();
|
|
|
54
54
|
@interface WindowSelectorOverlayView : NSView
|
|
55
55
|
@property (nonatomic, strong) NSDictionary *windowInfo;
|
|
56
56
|
@property (nonatomic) BOOL isActiveWindow;
|
|
57
|
+
@property (nonatomic) BOOL isToggled;
|
|
57
58
|
@end
|
|
58
59
|
|
|
59
60
|
@implementation WindowSelectorOverlayView
|
|
@@ -74,24 +75,28 @@ void updateScreenOverlays();
|
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
- (void)updateAppearance {
|
|
77
|
-
if (self.
|
|
78
|
-
//
|
|
78
|
+
if (self.isToggled) {
|
|
79
|
+
// Toggled window: same background, thick border
|
|
79
80
|
self.layer.backgroundColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4] CGColor];
|
|
80
|
-
|
|
81
|
+
self.layer.borderColor = [[NSColor whiteColor] CGColor];
|
|
82
|
+
self.layer.borderWidth = 3.0;
|
|
83
|
+
} else if (self.isActiveWindow) {
|
|
84
|
+
// Active window: brighter background, no border
|
|
85
|
+
self.layer.backgroundColor = [[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.4] CGColor];
|
|
86
|
+
self.layer.borderColor = [[NSColor clearColor] CGColor];
|
|
87
|
+
self.layer.borderWidth = 0.0;
|
|
81
88
|
} else {
|
|
82
|
-
// Inactive window: dimmer background
|
|
89
|
+
// Inactive window: dimmer background, no border
|
|
83
90
|
self.layer.backgroundColor = [[NSColor colorWithRed:0.4 green:0.2 blue:0.6 alpha:0.25] CGColor];
|
|
84
|
-
// Inactive window appearance set
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// No border to match screen selector
|
|
88
91
|
self.layer.borderColor = [[NSColor clearColor] CGColor];
|
|
89
92
|
self.layer.borderWidth = 0.0;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
self.layer.cornerRadius = 8.0;
|
|
96
|
+
self.layer.masksToBounds = YES;
|
|
97
|
+
self.layer.shadowOpacity = 0.0;
|
|
98
|
+
self.layer.shadowRadius = 0.0;
|
|
99
|
+
self.layer.shadowOffset = NSMakeSize(0, 0);
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
- (void)setIsActiveWindow:(BOOL)isActiveWindow {
|
|
@@ -101,6 +106,30 @@ void updateScreenOverlays();
|
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
108
|
|
|
109
|
+
- (void)setIsToggled:(BOOL)isToggled {
|
|
110
|
+
if (_isToggled != isToggled) {
|
|
111
|
+
_isToggled = isToggled;
|
|
112
|
+
[self updateAppearance];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Handle mouse clicks for toggle functionality
|
|
117
|
+
- (void)mouseDown:(NSEvent *)event {
|
|
118
|
+
[super mouseDown:event];
|
|
119
|
+
|
|
120
|
+
// Toggle the window state
|
|
121
|
+
self.isToggled = !self.isToggled;
|
|
122
|
+
|
|
123
|
+
// Bring window to front if toggled
|
|
124
|
+
if (self.isToggled && self.windowInfo) {
|
|
125
|
+
int windowId = [[self.windowInfo objectForKey:@"id"] intValue];
|
|
126
|
+
if (windowId > 0) {
|
|
127
|
+
bringWindowToFront(windowId);
|
|
128
|
+
NSLog(@"🔄 TOGGLED: Window brought to front - %@", [self.windowInfo objectForKey:@"title"]);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
104
133
|
// Layer-based approach, no custom drawing needed
|
|
105
134
|
|
|
106
135
|
@end
|
|
@@ -528,8 +557,9 @@ void updateOverlay() {
|
|
|
528
557
|
// Ensure overlay is on the correct screen
|
|
529
558
|
[g_overlayWindow setFrame:overlayFrame display:YES];
|
|
530
559
|
|
|
531
|
-
// Update overlay view window info
|
|
560
|
+
// Update overlay view window info and reset toggle state for new window
|
|
532
561
|
[(WindowSelectorOverlayView *)g_overlayView setWindowInfo:windowUnderCursor];
|
|
562
|
+
[(WindowSelectorOverlayView *)g_overlayView setIsToggled:NO];
|
|
533
563
|
|
|
534
564
|
// Add/update info label above button
|
|
535
565
|
NSTextField *infoLabel = nil;
|
|
@@ -1574,10 +1604,15 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1574
1604
|
|
|
1575
1605
|
// Cancel button reference will be found dynamically in positioning code
|
|
1576
1606
|
|
|
1577
|
-
//
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1607
|
+
// Start tracking timer for real-time window detection
|
|
1608
|
+
if (!g_delegate) {
|
|
1609
|
+
g_delegate = [[WindowSelectorDelegate alloc] init];
|
|
1610
|
+
}
|
|
1611
|
+
g_trackingTimer = [NSTimer scheduledTimerWithTimeInterval:0.05 // 20 FPS
|
|
1612
|
+
target:g_delegate
|
|
1613
|
+
selector:@selector(timerUpdate:)
|
|
1614
|
+
userInfo:nil
|
|
1615
|
+
repeats:YES];
|
|
1581
1616
|
|
|
1582
1617
|
// Add ESC key event monitor to cancel selection
|
|
1583
1618
|
g_windowKeyEventMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSEventMaskKeyDown
|