node-mac-recorder 2.5.1 → 2.5.3
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 +102 -41
package/package.json
CHANGED
package/src/window_selector.mm
CHANGED
|
@@ -67,14 +67,14 @@ bool hideScreenRecordingPreview();
|
|
|
67
67
|
|
|
68
68
|
if (!self.windowInfo) return;
|
|
69
69
|
|
|
70
|
-
// Background with transparency
|
|
71
|
-
[[NSColor colorWithRed:0.
|
|
70
|
+
// Background with transparency - purple tone
|
|
71
|
+
[[NSColor colorWithRed:0.4 green:0.3 blue:0.8 alpha:0.08] setFill];
|
|
72
72
|
NSRectFill(self.bounds);
|
|
73
73
|
|
|
74
|
-
//
|
|
75
|
-
[[NSColor colorWithRed:0.
|
|
76
|
-
NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,
|
|
77
|
-
[border setLineWidth:
|
|
74
|
+
// Ultra-thin border with darker purple
|
|
75
|
+
[[NSColor colorWithRed:0.5 green:0.3 blue:0.7 alpha:0.4] setStroke];
|
|
76
|
+
NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 0.125, 0.125) xRadius:12 yRadius:12];
|
|
77
|
+
[border setLineWidth:0.25];
|
|
78
78
|
[border stroke];
|
|
79
79
|
|
|
80
80
|
// Text will be handled by separate label above button
|
|
@@ -155,14 +155,14 @@ bool hideScreenRecordingPreview();
|
|
|
155
155
|
|
|
156
156
|
if (!self.screenInfo) return;
|
|
157
157
|
|
|
158
|
-
// Background with transparency
|
|
159
|
-
[[NSColor colorWithRed:0.
|
|
158
|
+
// Background with transparency - purple tone
|
|
159
|
+
[[NSColor colorWithRed:0.4 green:0.3 blue:0.8 alpha:0.12] setFill];
|
|
160
160
|
NSRectFill(self.bounds);
|
|
161
161
|
|
|
162
|
-
//
|
|
163
|
-
[[NSColor colorWithRed:0.
|
|
164
|
-
NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds,
|
|
165
|
-
[border setLineWidth:
|
|
162
|
+
// Ultra-thin border with darker purple
|
|
163
|
+
[[NSColor colorWithRed:0.5 green:0.3 blue:0.7 alpha:0.3] setStroke];
|
|
164
|
+
NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 0.125, 0.125) xRadius:15 yRadius:15];
|
|
165
|
+
[border setLineWidth:0.25];
|
|
166
166
|
[border stroke];
|
|
167
167
|
|
|
168
168
|
// Text will be handled by separate label above button
|
|
@@ -504,17 +504,56 @@ void updateOverlay() {
|
|
|
504
504
|
[infoLabel setAlignment:NSTextAlignmentCenter];
|
|
505
505
|
[infoLabel setFont:[NSFont systemFontOfSize:18 weight:NSFontWeightMedium]];
|
|
506
506
|
[infoLabel setTextColor:[NSColor whiteColor]];
|
|
507
|
-
[infoLabel setWantsLayer:YES];
|
|
508
|
-
|
|
509
|
-
// Add shadow for better visibility
|
|
510
|
-
[infoLabel.layer setShadowColor:[[NSColor blackColor] CGColor]];
|
|
511
|
-
[infoLabel.layer setShadowOffset:NSMakeSize(0, -1)];
|
|
512
|
-
[infoLabel.layer setShadowRadius:3.0];
|
|
513
|
-
[infoLabel.layer setShadowOpacity:0.8];
|
|
514
507
|
|
|
515
508
|
[g_overlayWindow.contentView addSubview:infoLabel];
|
|
516
509
|
}
|
|
517
510
|
|
|
511
|
+
// Add/update app icon
|
|
512
|
+
NSImageView *appIconView = nil;
|
|
513
|
+
for (NSView *subview in [g_overlayWindow.contentView subviews]) {
|
|
514
|
+
if ([subview isKindOfClass:[NSImageView class]]) {
|
|
515
|
+
appIconView = (NSImageView*)subview;
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (!appIconView) {
|
|
521
|
+
appIconView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 96, 96)];
|
|
522
|
+
[appIconView setImageScaling:NSImageScaleProportionallyUpOrDown];
|
|
523
|
+
[appIconView setWantsLayer:YES];
|
|
524
|
+
[appIconView.layer setCornerRadius:16.0];
|
|
525
|
+
[appIconView.layer setMasksToBounds:YES];
|
|
526
|
+
[appIconView.layer setBackgroundColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.3] CGColor]]; // Debug background
|
|
527
|
+
[g_overlayWindow.contentView addSubview:appIconView];
|
|
528
|
+
NSLog(@"🖼️ Created app icon view at frame: (%.0f, %.0f, %.0f, %.0f)",
|
|
529
|
+
appIconView.frame.origin.x, appIconView.frame.origin.y,
|
|
530
|
+
appIconView.frame.size.width, appIconView.frame.size.height);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Get app icon using NSWorkspace
|
|
534
|
+
NSString *iconAppName = [windowUnderCursor objectForKey:@"appName"] ?: @"Unknown";
|
|
535
|
+
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
|
|
536
|
+
NSArray *runningApps = [workspace runningApplications];
|
|
537
|
+
NSImage *appIcon = nil;
|
|
538
|
+
|
|
539
|
+
for (NSRunningApplication *app in runningApps) {
|
|
540
|
+
if ([[app localizedName] isEqualToString:iconAppName] || [[app bundleIdentifier] containsString:iconAppName]) {
|
|
541
|
+
appIcon = [app icon];
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// Fallback to generic app icon if not found
|
|
547
|
+
if (!appIcon) {
|
|
548
|
+
appIcon = [workspace iconForFileType:NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
|
|
549
|
+
NSLog(@"⚠️ Using fallback icon for app: %@", iconAppName);
|
|
550
|
+
} else {
|
|
551
|
+
NSLog(@"✅ Found app icon for: %@", iconAppName);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
[appIconView setImage:appIcon];
|
|
555
|
+
NSLog(@"🖼️ Set icon image, size: %.0fx%.0f", [appIcon size].width, [appIcon size].height);
|
|
556
|
+
|
|
518
557
|
// Update label text
|
|
519
558
|
NSString *labelWindowTitle = [windowUnderCursor objectForKey:@"title"] ?: @"Unknown Window";
|
|
520
559
|
NSString *labelAppName = [windowUnderCursor objectForKey:@"appName"] ?: @"Unknown App";
|
|
@@ -529,10 +568,19 @@ void updateOverlay() {
|
|
|
529
568
|
);
|
|
530
569
|
[g_selectButton setFrameOrigin:buttonCenter];
|
|
531
570
|
|
|
532
|
-
// Position
|
|
571
|
+
// Position app icon above text label
|
|
572
|
+
NSPoint iconCenter = NSMakePoint(
|
|
573
|
+
(width - 96) / 2, // Center horizontally (icon is 96px wide)
|
|
574
|
+
buttonCenter.y + buttonSize.height + 60 + 10 // Above label + text height + margin
|
|
575
|
+
);
|
|
576
|
+
[appIconView setFrameOrigin:iconCenter];
|
|
577
|
+
NSLog(@"🎯 Positioning app icon at: (%.0f, %.0f) for window size: (%.0f, %.0f)",
|
|
578
|
+
iconCenter.x, iconCenter.y, (float)width, (float)height);
|
|
579
|
+
|
|
580
|
+
// Position info label at overlay center, above button
|
|
533
581
|
NSPoint labelCenter = NSMakePoint(
|
|
534
|
-
|
|
535
|
-
buttonCenter.y + buttonSize.height + 10 // 10px above button
|
|
582
|
+
(width - [infoLabel frame].size.width) / 2, // Center horizontally
|
|
583
|
+
buttonCenter.y + buttonSize.height + 10 // 10px above button, below icon
|
|
536
584
|
);
|
|
537
585
|
[infoLabel setFrameOrigin:labelCenter];
|
|
538
586
|
|
|
@@ -781,9 +829,9 @@ bool startScreenSelection() {
|
|
|
781
829
|
[selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]];
|
|
782
830
|
[selectButton setTag:i]; // Set screen index as tag
|
|
783
831
|
|
|
784
|
-
// Modern button styling with gradient-like effect
|
|
832
|
+
// Modern button styling with purple gradient-like effect
|
|
785
833
|
[selectButton setWantsLayer:YES];
|
|
786
|
-
[selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.
|
|
834
|
+
[selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.5 green:0.3 blue:0.8 alpha:0.95] CGColor]];
|
|
787
835
|
[selectButton.layer setCornerRadius:14.0];
|
|
788
836
|
[selectButton.layer setBorderWidth:0.0];
|
|
789
837
|
|
|
@@ -796,17 +844,17 @@ bool startScreenSelection() {
|
|
|
796
844
|
range:NSMakeRange(0, [titleString length])];
|
|
797
845
|
[selectButton setAttributedTitle:titleString];
|
|
798
846
|
|
|
799
|
-
// Enhanced shadow for modern look
|
|
800
|
-
[selectButton.layer setShadowColor:[[NSColor colorWithRed:0.
|
|
847
|
+
// Enhanced shadow for modern look - purple tone
|
|
848
|
+
[selectButton.layer setShadowColor:[[NSColor colorWithRed:0.4 green:0.2 blue:0.6 alpha:0.8] CGColor]];
|
|
801
849
|
[selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
|
|
802
850
|
[selectButton.layer setShadowRadius:8.0];
|
|
803
851
|
[selectButton.layer setShadowOpacity:0.4];
|
|
804
852
|
|
|
805
|
-
// Add subtle inner highlight
|
|
853
|
+
// Add subtle inner highlight - purple tone
|
|
806
854
|
CALayer *highlightLayer = [CALayer layer];
|
|
807
855
|
[highlightLayer setFrame:CGRectMake(0, selectButton.frame.size.height * 0.6,
|
|
808
856
|
selectButton.frame.size.width, selectButton.frame.size.height * 0.4)];
|
|
809
|
-
[highlightLayer setBackgroundColor:[[NSColor colorWithRed:0.
|
|
857
|
+
[highlightLayer setBackgroundColor:[[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.3] CGColor]];
|
|
810
858
|
[highlightLayer setCornerRadius:14.0];
|
|
811
859
|
[selectButton.layer addSublayer:highlightLayer];
|
|
812
860
|
|
|
@@ -857,13 +905,18 @@ bool startScreenSelection() {
|
|
|
857
905
|
[screenInfoLabel setAlignment:NSTextAlignmentCenter];
|
|
858
906
|
[screenInfoLabel setFont:[NSFont systemFontOfSize:20 weight:NSFontWeightMedium]];
|
|
859
907
|
[screenInfoLabel setTextColor:[NSColor whiteColor]];
|
|
860
|
-
[screenInfoLabel setWantsLayer:YES];
|
|
861
908
|
|
|
862
|
-
//
|
|
863
|
-
|
|
864
|
-
[
|
|
865
|
-
[
|
|
866
|
-
[
|
|
909
|
+
// Create screen icon (display icon)
|
|
910
|
+
NSImageView *screenIconView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 96, 96)];
|
|
911
|
+
[screenIconView setImageScaling:NSImageScaleProportionallyUpOrDown];
|
|
912
|
+
[screenIconView setWantsLayer:YES];
|
|
913
|
+
[screenIconView.layer setCornerRadius:16.0];
|
|
914
|
+
[screenIconView.layer setMasksToBounds:YES];
|
|
915
|
+
|
|
916
|
+
// Set display icon
|
|
917
|
+
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
|
|
918
|
+
NSImage *displayIcon = [workspace iconForFileType:NSFileTypeForHFSTypeCode(kComputerIcon)];
|
|
919
|
+
[screenIconView setImage:displayIcon];
|
|
867
920
|
|
|
868
921
|
// Set screen info text
|
|
869
922
|
NSString *screenName = [screenInfo objectForKey:@"name"] ?: @"Unknown Screen";
|
|
@@ -877,10 +930,17 @@ bool startScreenSelection() {
|
|
|
877
930
|
);
|
|
878
931
|
[selectButton setFrameOrigin:buttonCenter];
|
|
879
932
|
|
|
880
|
-
// Position
|
|
933
|
+
// Position screen icon above text label
|
|
934
|
+
NSPoint iconCenter = NSMakePoint(
|
|
935
|
+
(screenFrame.size.width - 96) / 2, // Center horizontally (icon is 96px wide)
|
|
936
|
+
buttonCenter.y + [selectButton frame].size.height + 60 + 10 // Above label + text height + margin
|
|
937
|
+
);
|
|
938
|
+
[screenIconView setFrameOrigin:iconCenter];
|
|
939
|
+
|
|
940
|
+
// Position info label at screen center, above button
|
|
881
941
|
NSPoint labelCenter = NSMakePoint(
|
|
882
|
-
|
|
883
|
-
buttonCenter.y + [selectButton frame].size.height + 10 // 10px above button
|
|
942
|
+
(screenFrame.size.width - [screenInfoLabel frame].size.width) / 2, // Center horizontally
|
|
943
|
+
buttonCenter.y + [selectButton frame].size.height + 10 // 10px above button, below icon
|
|
884
944
|
);
|
|
885
945
|
[screenInfoLabel setFrameOrigin:labelCenter];
|
|
886
946
|
|
|
@@ -890,6 +950,7 @@ bool startScreenSelection() {
|
|
|
890
950
|
);
|
|
891
951
|
[screenCancelButton setFrameOrigin:cancelButtonCenter];
|
|
892
952
|
|
|
953
|
+
[overlayView addSubview:screenIconView];
|
|
893
954
|
[overlayView addSubview:screenInfoLabel];
|
|
894
955
|
[overlayView addSubview:selectButton];
|
|
895
956
|
[overlayView addSubview:screenCancelButton];
|
|
@@ -1053,9 +1114,9 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1053
1114
|
[g_selectButton setBezelStyle:NSBezelStyleRegularSquare];
|
|
1054
1115
|
[g_selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]];
|
|
1055
1116
|
|
|
1056
|
-
// Modern button styling with gradient-like effect
|
|
1117
|
+
// Modern button styling with purple gradient-like effect
|
|
1057
1118
|
[g_selectButton setWantsLayer:YES];
|
|
1058
|
-
[g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.
|
|
1119
|
+
[g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.5 green:0.3 blue:0.8 alpha:0.95] CGColor]];
|
|
1059
1120
|
[g_selectButton.layer setCornerRadius:14.0];
|
|
1060
1121
|
[g_selectButton.layer setBorderWidth:0.0];
|
|
1061
1122
|
|
|
@@ -1068,8 +1129,8 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1068
1129
|
range:NSMakeRange(0, [titleString length])];
|
|
1069
1130
|
[g_selectButton setAttributedTitle:titleString];
|
|
1070
1131
|
|
|
1071
|
-
// Enhanced shadow for modern look
|
|
1072
|
-
[g_selectButton.layer setShadowColor:[[NSColor colorWithRed:0.
|
|
1132
|
+
// Enhanced shadow for modern look - purple tone
|
|
1133
|
+
[g_selectButton.layer setShadowColor:[[NSColor colorWithRed:0.4 green:0.2 blue:0.6 alpha:0.8] CGColor]];
|
|
1073
1134
|
[g_selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
|
|
1074
1135
|
[g_selectButton.layer setShadowRadius:8.0];
|
|
1075
1136
|
[g_selectButton.layer setShadowOpacity:0.4];
|