node-mac-recorder 2.5.2 → 2.5.4

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.2",
3
+ "version": "2.5.4",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -5,6 +5,7 @@
5
5
  #import <ApplicationServices/ApplicationServices.h>
6
6
  #import <Carbon/Carbon.h>
7
7
  #import <Accessibility/Accessibility.h>
8
+ #import <QuartzCore/QuartzCore.h>
8
9
 
9
10
  // Global state for window selection
10
11
  static bool g_isWindowSelecting = false;
@@ -67,16 +68,10 @@ bool hideScreenRecordingPreview();
67
68
 
68
69
  if (!self.windowInfo) return;
69
70
 
70
- // Background with transparency - purple tone
71
- [[NSColor colorWithRed:0.4 green:0.3 blue:0.8 alpha:0.08] setFill];
71
+ // Background with transparency - purple tone (no border)
72
+ [[NSColor colorWithRed:0.5 green:0.3 blue:0.8 alpha:0.25] setFill];
72
73
  NSRectFill(self.bounds);
73
74
 
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
- [border stroke];
79
-
80
75
  // Text will be handled by separate label above button
81
76
  }
82
77
 
@@ -155,16 +150,10 @@ bool hideScreenRecordingPreview();
155
150
 
156
151
  if (!self.screenInfo) return;
157
152
 
158
- // Background with transparency - purple tone
159
- [[NSColor colorWithRed:0.4 green:0.3 blue:0.8 alpha:0.12] setFill];
153
+ // Background with transparency - purple tone (no border)
154
+ [[NSColor colorWithRed:0.5 green:0.3 blue:0.8 alpha:0.3] setFill];
160
155
  NSRectFill(self.bounds);
161
156
 
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
- [border stroke];
167
-
168
157
  // Text will be handled by separate label above button
169
158
  }
170
159
 
@@ -521,9 +510,13 @@ void updateOverlay() {
521
510
  appIconView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 96, 96)];
522
511
  [appIconView setImageScaling:NSImageScaleProportionallyUpOrDown];
523
512
  [appIconView setWantsLayer:YES];
524
- [appIconView.layer setCornerRadius:16.0]; // Rounded corners like iOS
513
+ [appIconView.layer setCornerRadius:16.0];
525
514
  [appIconView.layer setMasksToBounds:YES];
515
+ [appIconView.layer setBackgroundColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.3] CGColor]]; // Debug background
526
516
  [g_overlayWindow.contentView addSubview:appIconView];
517
+ NSLog(@"🖼️ Created app icon view at frame: (%.0f, %.0f, %.0f, %.0f)",
518
+ appIconView.frame.origin.x, appIconView.frame.origin.y,
519
+ appIconView.frame.size.width, appIconView.frame.size.height);
527
520
  }
528
521
 
529
522
  // Get app icon using NSWorkspace
@@ -542,9 +535,13 @@ void updateOverlay() {
542
535
  // Fallback to generic app icon if not found
543
536
  if (!appIcon) {
544
537
  appIcon = [workspace iconForFileType:NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
538
+ NSLog(@"⚠️ Using fallback icon for app: %@", iconAppName);
539
+ } else {
540
+ NSLog(@"✅ Found app icon for: %@", iconAppName);
545
541
  }
546
542
 
547
543
  [appIconView setImage:appIcon];
544
+ NSLog(@"🖼️ Set icon image, size: %.0fx%.0f", [appIcon size].width, [appIcon size].height);
548
545
 
549
546
  // Update label text
550
547
  NSString *labelWindowTitle = [windowUnderCursor objectForKey:@"title"] ?: @"Unknown Window";
@@ -566,6 +563,32 @@ void updateOverlay() {
566
563
  buttonCenter.y + buttonSize.height + 60 + 10 // Above label + text height + margin
567
564
  );
568
565
  [appIconView setFrameOrigin:iconCenter];
566
+ NSLog(@"🎯 Positioning app icon at: (%.0f, %.0f) for window size: (%.0f, %.0f)",
567
+ iconCenter.x, iconCenter.y, (float)width, (float)height);
568
+
569
+ // Add smooth floating animation after positioning
570
+ [appIconView.layer removeAnimationForKey:@"floatAnimation"];
571
+ [appIconView.layer removeAnimationForKey:@"floatAnimationY"];
572
+
573
+ // Horizontal float animation
574
+ CABasicAnimation *floatAnimationX = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
575
+ floatAnimationX.fromValue = @(-5.0);
576
+ floatAnimationX.toValue = @(5.0);
577
+ floatAnimationX.duration = 3.5;
578
+ floatAnimationX.repeatCount = HUGE_VALF;
579
+ floatAnimationX.autoreverses = YES;
580
+ floatAnimationX.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
581
+ [appIconView.layer addAnimation:floatAnimationX forKey:@"floatAnimationX"];
582
+
583
+ // Subtle vertical float animation (slightly offset timing)
584
+ CABasicAnimation *floatAnimationY = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
585
+ floatAnimationY.fromValue = @(-2.0);
586
+ floatAnimationY.toValue = @(2.0);
587
+ floatAnimationY.duration = 4.5;
588
+ floatAnimationY.repeatCount = HUGE_VALF;
589
+ floatAnimationY.autoreverses = YES;
590
+ floatAnimationY.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
591
+ [appIconView.layer addAnimation:floatAnimationY forKey:@"floatAnimationY"];
569
592
 
570
593
  // Position info label at overlay center, above button
571
594
  NSPoint labelCenter = NSMakePoint(
@@ -811,22 +834,23 @@ bool startScreenSelection() {
811
834
  [overlayView setScreenInfo:screenInfo];
812
835
  [overlayWindow setContentView:overlayView];
813
836
 
814
- // Create select button
815
- NSButton *selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 180, 60)];
837
+ // Create select button with more padding
838
+ NSButton *selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
816
839
  [selectButton setTitle:@"Start Record"];
817
840
  [selectButton setButtonType:NSButtonTypeMomentaryPushIn];
818
841
  [selectButton setBezelStyle:NSBezelStyleRegularSquare];
819
- [selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]];
842
+ [selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightRegular]];
820
843
  [selectButton setTag:i]; // Set screen index as tag
821
844
 
822
- // Modern button styling with gradient-like effect
845
+ // Modern button styling with purple tone
823
846
  [selectButton setWantsLayer:YES];
824
- [selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.1 green:0.5 blue:0.9 alpha:0.95] CGColor]];
847
+ [selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.55 green:0.3 blue:0.75 alpha:0.95] CGColor]];
825
848
  [selectButton.layer setCornerRadius:14.0];
826
849
  [selectButton.layer setBorderWidth:0.0];
827
850
 
828
- // White text color with better font weight
829
- [selectButton setFont:[NSFont systemFontOfSize:17 weight:NSFontWeightSemibold]];
851
+ // Clean white text - normal weight
852
+ [selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightRegular]];
853
+ [selectButton setTitle:@"Start Record"];
830
854
  NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]
831
855
  initWithString:[selectButton title]];
832
856
  [titleString addAttribute:NSForegroundColorAttributeName
@@ -834,19 +858,7 @@ bool startScreenSelection() {
834
858
  range:NSMakeRange(0, [titleString length])];
835
859
  [selectButton setAttributedTitle:titleString];
836
860
 
837
- // Enhanced shadow for modern look
838
- [selectButton.layer setShadowColor:[[NSColor colorWithRed:0.0 green:0.3 blue:0.7 alpha:0.8] CGColor]];
839
- [selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
840
- [selectButton.layer setShadowRadius:8.0];
841
- [selectButton.layer setShadowOpacity:0.4];
842
-
843
- // Add subtle inner highlight
844
- CALayer *highlightLayer = [CALayer layer];
845
- [highlightLayer setFrame:CGRectMake(0, selectButton.frame.size.height * 0.6,
846
- selectButton.frame.size.width, selectButton.frame.size.height * 0.4)];
847
- [highlightLayer setBackgroundColor:[[NSColor colorWithRed:0.3 green:0.7 blue:1.0 alpha:0.3] CGColor]];
848
- [highlightLayer setCornerRadius:14.0];
849
- [selectButton.layer addSublayer:highlightLayer];
861
+ // Clean button - no shadows or highlights
850
862
 
851
863
  // Set button target and action (reuse global delegate)
852
864
  if (!g_delegate) {
@@ -862,14 +874,14 @@ bool startScreenSelection() {
862
874
  [screenCancelButton setBezelStyle:NSBezelStyleRegularSquare];
863
875
  [screenCancelButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightMedium]];
864
876
 
865
- // Modern cancel button styling
877
+ // Modern cancel button styling - darker gray, clean
866
878
  [screenCancelButton setWantsLayer:YES];
867
- [screenCancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.4 green:0.4 blue:0.4 alpha:0.9] CGColor]];
879
+ [screenCancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.35 green:0.35 blue:0.4 alpha:0.9] CGColor]];
868
880
  [screenCancelButton.layer setCornerRadius:12.0];
869
881
  [screenCancelButton.layer setBorderWidth:0.0];
870
882
 
871
- // White text for cancel button with better font
872
- [screenCancelButton setFont:[NSFont systemFontOfSize:15 weight:NSFontWeightMedium]];
883
+ // Clean white text for cancel button
884
+ [screenCancelButton setFont:[NSFont systemFontOfSize:15 weight:NSFontWeightRegular]];
873
885
  NSMutableAttributedString *screenCancelTitleString = [[NSMutableAttributedString alloc]
874
886
  initWithString:[screenCancelButton title]];
875
887
  [screenCancelTitleString addAttribute:NSForegroundColorAttributeName
@@ -877,12 +889,6 @@ bool startScreenSelection() {
877
889
  range:NSMakeRange(0, [screenCancelTitleString length])];
878
890
  [screenCancelButton setAttributedTitle:screenCancelTitleString];
879
891
 
880
- // Enhanced shadow for cancel button
881
- [screenCancelButton.layer setShadowColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.8] CGColor]];
882
- [screenCancelButton.layer setShadowOffset:NSMakeSize(0, -2)];
883
- [screenCancelButton.layer setShadowRadius:4.0];
884
- [screenCancelButton.layer setShadowOpacity:0.3];
885
-
886
892
  [screenCancelButton setTarget:g_delegate];
887
893
  [screenCancelButton setAction:@selector(cancelButtonClicked:)];
888
894
 
@@ -927,6 +933,26 @@ bool startScreenSelection() {
927
933
  );
928
934
  [screenIconView setFrameOrigin:iconCenter];
929
935
 
936
+ // Add smooth floating animation to screen icon
937
+ CABasicAnimation *screenFloatAnimationX = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
938
+ screenFloatAnimationX.fromValue = @(-5.0);
939
+ screenFloatAnimationX.toValue = @(5.0);
940
+ screenFloatAnimationX.duration = 4.0; // Slightly different duration for variety
941
+ screenFloatAnimationX.repeatCount = HUGE_VALF;
942
+ screenFloatAnimationX.autoreverses = YES;
943
+ screenFloatAnimationX.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
944
+ [screenIconView.layer addAnimation:screenFloatAnimationX forKey:@"floatAnimationX"];
945
+
946
+ // Subtle vertical float for screen icon
947
+ CABasicAnimation *screenFloatAnimationY = [CABasicAnimation animationWithKeyPath:@"transform.translation.y"];
948
+ screenFloatAnimationY.fromValue = @(-2.0);
949
+ screenFloatAnimationY.toValue = @(2.0);
950
+ screenFloatAnimationY.duration = 5.0; // Different timing than window icons
951
+ screenFloatAnimationY.repeatCount = HUGE_VALF;
952
+ screenFloatAnimationY.autoreverses = YES;
953
+ screenFloatAnimationY.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
954
+ [screenIconView.layer addAnimation:screenFloatAnimationY forKey:@"floatAnimationY"];
955
+
930
956
  // Position info label at screen center, above button
931
957
  NSPoint labelCenter = NSMakePoint(
932
958
  (screenFrame.size.width - [screenInfoLabel frame].size.width) / 2, // Center horizontally
@@ -1097,21 +1123,20 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1097
1123
  g_overlayView = [[WindowSelectorOverlayView alloc] initWithFrame:initialFrame];
1098
1124
  [g_overlayWindow setContentView:g_overlayView];
1099
1125
 
1100
- // Create select button with blue theme
1101
- g_selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 160, 60)];
1126
+ // Create select button with purple theme
1127
+ g_selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
1102
1128
  [g_selectButton setTitle:@"Start Record"];
1103
1129
  [g_selectButton setButtonType:NSButtonTypeMomentaryPushIn];
1104
1130
  [g_selectButton setBezelStyle:NSBezelStyleRegularSquare];
1105
- [g_selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]];
1131
+ [g_selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightRegular]];
1106
1132
 
1107
- // Modern button styling with gradient-like effect
1133
+ // Modern button styling with purple tone
1108
1134
  [g_selectButton setWantsLayer:YES];
1109
- [g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.1 green:0.5 blue:0.9 alpha:0.95] CGColor]];
1135
+ [g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.55 green:0.3 blue:0.75 alpha:0.95] CGColor]];
1110
1136
  [g_selectButton.layer setCornerRadius:14.0];
1111
1137
  [g_selectButton.layer setBorderWidth:0.0];
1112
1138
 
1113
- // White text color with better font weight
1114
- [g_selectButton setFont:[NSFont systemFontOfSize:17 weight:NSFontWeightSemibold]];
1139
+ // Clean white text - normal weight
1115
1140
  NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]
1116
1141
  initWithString:[g_selectButton title]];
1117
1142
  [titleString addAttribute:NSForegroundColorAttributeName
@@ -1119,12 +1144,6 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1119
1144
  range:NSMakeRange(0, [titleString length])];
1120
1145
  [g_selectButton setAttributedTitle:titleString];
1121
1146
 
1122
- // Enhanced shadow for modern look
1123
- [g_selectButton.layer setShadowColor:[[NSColor colorWithRed:0.0 green:0.3 blue:0.7 alpha:0.8] CGColor]];
1124
- [g_selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
1125
- [g_selectButton.layer setShadowRadius:8.0];
1126
- [g_selectButton.layer setShadowOpacity:0.4];
1127
-
1128
1147
  // Create delegate for button action and timer
1129
1148
  g_delegate = [[WindowSelectorDelegate alloc] init];
1130
1149
  [g_selectButton setTarget:g_delegate];
@@ -1138,16 +1157,15 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1138
1157
  [cancelButton setTitle:@"Cancel"];
1139
1158
  [cancelButton setButtonType:NSButtonTypeMomentaryPushIn];
1140
1159
  [cancelButton setBezelStyle:NSBezelStyleRegularSquare];
1141
- [cancelButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightMedium]];
1160
+ [cancelButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightRegular]];
1142
1161
 
1143
- // Modern cancel button styling
1162
+ // Modern cancel button styling - darker gray, clean
1144
1163
  [cancelButton setWantsLayer:YES];
1145
- [cancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.4 green:0.4 blue:0.4 alpha:0.9] CGColor]];
1164
+ [cancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.35 green:0.35 blue:0.4 alpha:0.9] CGColor]];
1146
1165
  [cancelButton.layer setCornerRadius:12.0];
1147
1166
  [cancelButton.layer setBorderWidth:0.0];
1148
1167
 
1149
- // White text for cancel button with better font
1150
- [cancelButton setFont:[NSFont systemFontOfSize:15 weight:NSFontWeightMedium]];
1168
+ // Clean white text for cancel button
1151
1169
  NSMutableAttributedString *cancelTitleString = [[NSMutableAttributedString alloc]
1152
1170
  initWithString:[cancelButton title]];
1153
1171
  [cancelTitleString addAttribute:NSForegroundColorAttributeName
@@ -1155,12 +1173,6 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
1155
1173
  range:NSMakeRange(0, [cancelTitleString length])];
1156
1174
  [cancelButton setAttributedTitle:cancelTitleString];
1157
1175
 
1158
- // Enhanced shadow for cancel button
1159
- [cancelButton.layer setShadowColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.8] CGColor]];
1160
- [cancelButton.layer setShadowOffset:NSMakeSize(0, -2)];
1161
- [cancelButton.layer setShadowRadius:4.0];
1162
- [cancelButton.layer setShadowOpacity:0.3];
1163
-
1164
1176
  [cancelButton setTarget:g_delegate];
1165
1177
  [cancelButton setAction:@selector(cancelButtonClicked:)];
1166
1178