node-mac-recorder 2.5.1 → 2.5.2

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -67,14 +67,14 @@ bool hideScreenRecordingPreview();
67
67
 
68
68
  if (!self.windowInfo) return;
69
69
 
70
- // Background with transparency
71
- [[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.3] setFill];
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
- // Modern border with rounded corners
75
- [[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.8] setStroke];
76
- NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 2, 2) xRadius:12 yRadius:12];
77
- [border setLineWidth:4.0];
74
+ // Thin border with darker purple
75
+ [[NSColor colorWithRed:0.3 green:0.2 blue:0.6 alpha:0.6] setStroke];
76
+ NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 0.5, 0.5) xRadius:12 yRadius:12];
77
+ [border setLineWidth:1.0];
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.2 green:0.6 blue:1.0 alpha:0.25] setFill];
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
- // Modern border with rounded corners
163
- [[NSColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:0.7] setStroke];
164
- NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 3, 3) xRadius:15 yRadius:15];
165
- [border setLineWidth:6.0];
162
+ // Thin border with darker purple
163
+ [[NSColor colorWithRed:0.3 green:0.2 blue:0.6 alpha:0.5] setStroke];
164
+ NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:NSInsetRect(self.bounds, 0.5, 0.5) xRadius:15 yRadius:15];
165
+ [border setLineWidth:1.0];
166
166
  [border stroke];
167
167
 
168
168
  // Text will be handled by separate label above button
@@ -504,17 +504,48 @@ 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]; // Rounded corners like iOS
525
+ [appIconView.layer setMasksToBounds:YES];
526
+ [g_overlayWindow.contentView addSubview:appIconView];
527
+ }
528
+
529
+ // Get app icon using NSWorkspace
530
+ NSString *iconAppName = [windowUnderCursor objectForKey:@"appName"] ?: @"Unknown";
531
+ NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
532
+ NSArray *runningApps = [workspace runningApplications];
533
+ NSImage *appIcon = nil;
534
+
535
+ for (NSRunningApplication *app in runningApps) {
536
+ if ([[app localizedName] isEqualToString:iconAppName] || [[app bundleIdentifier] containsString:iconAppName]) {
537
+ appIcon = [app icon];
538
+ break;
539
+ }
540
+ }
541
+
542
+ // Fallback to generic app icon if not found
543
+ if (!appIcon) {
544
+ appIcon = [workspace iconForFileType:NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
545
+ }
546
+
547
+ [appIconView setImage:appIcon];
548
+
518
549
  // Update label text
519
550
  NSString *labelWindowTitle = [windowUnderCursor objectForKey:@"title"] ?: @"Unknown Window";
520
551
  NSString *labelAppName = [windowUnderCursor objectForKey:@"appName"] ?: @"Unknown App";
@@ -529,10 +560,17 @@ void updateOverlay() {
529
560
  );
530
561
  [g_selectButton setFrameOrigin:buttonCenter];
531
562
 
532
- // Position info label above button
563
+ // Position app icon above text label
564
+ NSPoint iconCenter = NSMakePoint(
565
+ (width - 96) / 2, // Center horizontally (icon is 96px wide)
566
+ buttonCenter.y + buttonSize.height + 60 + 10 // Above label + text height + margin
567
+ );
568
+ [appIconView setFrameOrigin:iconCenter];
569
+
570
+ // Position info label at overlay center, above button
533
571
  NSPoint labelCenter = NSMakePoint(
534
- 20,
535
- buttonCenter.y + buttonSize.height + 10 // 10px above button
572
+ (width - [infoLabel frame].size.width) / 2, // Center horizontally
573
+ buttonCenter.y + buttonSize.height + 10 // 10px above button, below icon
536
574
  );
537
575
  [infoLabel setFrameOrigin:labelCenter];
538
576
 
@@ -857,13 +895,18 @@ bool startScreenSelection() {
857
895
  [screenInfoLabel setAlignment:NSTextAlignmentCenter];
858
896
  [screenInfoLabel setFont:[NSFont systemFontOfSize:20 weight:NSFontWeightMedium]];
859
897
  [screenInfoLabel setTextColor:[NSColor whiteColor]];
860
- [screenInfoLabel setWantsLayer:YES];
861
898
 
862
- // Add shadow for better visibility
863
- [screenInfoLabel.layer setShadowColor:[[NSColor blackColor] CGColor]];
864
- [screenInfoLabel.layer setShadowOffset:NSMakeSize(0, -2)];
865
- [screenInfoLabel.layer setShadowRadius:4.0];
866
- [screenInfoLabel.layer setShadowOpacity:0.8];
899
+ // Create screen icon (display icon)
900
+ NSImageView *screenIconView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 96, 96)];
901
+ [screenIconView setImageScaling:NSImageScaleProportionallyUpOrDown];
902
+ [screenIconView setWantsLayer:YES];
903
+ [screenIconView.layer setCornerRadius:16.0];
904
+ [screenIconView.layer setMasksToBounds:YES];
905
+
906
+ // Set display icon
907
+ NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
908
+ NSImage *displayIcon = [workspace iconForFileType:NSFileTypeForHFSTypeCode(kComputerIcon)];
909
+ [screenIconView setImage:displayIcon];
867
910
 
868
911
  // Set screen info text
869
912
  NSString *screenName = [screenInfo objectForKey:@"name"] ?: @"Unknown Screen";
@@ -877,10 +920,17 @@ bool startScreenSelection() {
877
920
  );
878
921
  [selectButton setFrameOrigin:buttonCenter];
879
922
 
880
- // Position info label above button
923
+ // Position screen icon above text label
924
+ NSPoint iconCenter = NSMakePoint(
925
+ (screenFrame.size.width - 96) / 2, // Center horizontally (icon is 96px wide)
926
+ buttonCenter.y + [selectButton frame].size.height + 60 + 10 // Above label + text height + margin
927
+ );
928
+ [screenIconView setFrameOrigin:iconCenter];
929
+
930
+ // Position info label at screen center, above button
881
931
  NSPoint labelCenter = NSMakePoint(
882
- 20,
883
- buttonCenter.y + [selectButton frame].size.height + 10 // 10px above button
932
+ (screenFrame.size.width - [screenInfoLabel frame].size.width) / 2, // Center horizontally
933
+ buttonCenter.y + [selectButton frame].size.height + 10 // 10px above button, below icon
884
934
  );
885
935
  [screenInfoLabel setFrameOrigin:labelCenter];
886
936
 
@@ -890,6 +940,7 @@ bool startScreenSelection() {
890
940
  );
891
941
  [screenCancelButton setFrameOrigin:cancelButtonCenter];
892
942
 
943
+ [overlayView addSubview:screenIconView];
893
944
  [overlayView addSubview:screenInfoLabel];
894
945
  [overlayView addSubview:selectButton];
895
946
  [overlayView addSubview:screenCancelButton];