node-mac-recorder 2.20.14 → 2.20.16

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.
@@ -4,7 +4,8 @@
4
4
  "Bash(node-gyp:*)",
5
5
  "Bash(node:*)",
6
6
  "Bash(timeout:*)",
7
- "Bash(open:*)"
7
+ "Bash(open:*)",
8
+ "Read(//Users/onur/codes/**)"
8
9
  ],
9
10
  "deny": [],
10
11
  "ask": []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "2.20.14",
3
+ "version": "2.20.16",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -56,6 +56,79 @@ static id g_screenKeyEventMonitor = nil;
56
56
  static NSTimer *g_screenTrackingTimer = nil;
57
57
  static NSInteger g_currentActiveScreenIndex = -1;
58
58
 
59
+ // Record icon helpers
60
+ static NSImage *CreateRecordIconImage(CGFloat size) {
61
+ const CGFloat leadingInset = 8.0;
62
+ const CGFloat trailingSpacing = 6.0;
63
+ CGFloat width = leadingInset + size + trailingSpacing;
64
+ NSImage *image = [[[NSImage alloc] initWithSize:NSMakeSize(width, size)] autorelease];
65
+ if (!image) {
66
+ return nil;
67
+ }
68
+
69
+ [image lockFocus];
70
+
71
+ [[NSColor clearColor] setFill];
72
+ NSRectFill(NSMakeRect(0, 0, width, size));
73
+
74
+ CGFloat strokeWidth = MAX(2.0, size * 0.12);
75
+ NSRect iconRect = NSMakeRect(leadingInset,
76
+ (size - size) / 2.0,
77
+ size,
78
+ size);
79
+ NSRect outerRect = NSInsetRect(iconRect, strokeWidth / 2.0, strokeWidth / 2.0);
80
+ NSBezierPath *outerPath = [NSBezierPath bezierPathWithOvalInRect:outerRect];
81
+ [outerPath setLineWidth:strokeWidth];
82
+ [[NSColor whiteColor] setStroke];
83
+ [outerPath stroke];
84
+
85
+ CGFloat innerDiameter = size * 0.45;
86
+ NSRect innerRect = NSMakeRect(NSMidX(iconRect) - innerDiameter / 2.0,
87
+ NSMidY(iconRect) - innerDiameter / 2.0,
88
+ innerDiameter,
89
+ innerDiameter);
90
+ NSBezierPath *innerPath = [NSBezierPath bezierPathWithOvalInRect:innerRect];
91
+ [[NSColor whiteColor] setFill];
92
+ [innerPath fill];
93
+
94
+ [image unlockFocus];
95
+ [image setTemplate:NO];
96
+
97
+ return image;
98
+ }
99
+
100
+ static NSImage *GetStartRecordIcon(void) {
101
+ static NSImage *recordIcon = nil;
102
+ if (!recordIcon) {
103
+ recordIcon = [CreateRecordIconImage(18.0) retain];
104
+ }
105
+ return recordIcon;
106
+ }
107
+
108
+ static void ApplyStartRecordButtonIcon(NSButton *button) {
109
+ if (!button) {
110
+ return;
111
+ }
112
+
113
+ NSImage *icon = GetStartRecordIcon();
114
+ if (!icon) {
115
+ return;
116
+ }
117
+
118
+ [button setImage:icon];
119
+ [button setImageScaling:NSImageScaleNone];
120
+ [button setImagePosition:NSImageLeft];
121
+
122
+ if ([button respondsToSelector:@selector(setContentInsets:)]) {
123
+ NSEdgeInsets insets = NSEdgeInsetsMake(0, 12.0, 0, 12.0);
124
+ [button setContentInsets:insets];
125
+ }
126
+
127
+ if ([button respondsToSelector:@selector(setContentTintColor:)]) {
128
+ [button setContentTintColor:[NSColor whiteColor]];
129
+ }
130
+ }
131
+
59
132
  // Forward declarations
60
133
  void cleanupWindowSelector();
61
134
  void updateOverlay();
@@ -1133,7 +1206,9 @@ void updateOverlay() {
1133
1206
  [targetOverlay.contentView addSubview:targetSelectButton];
1134
1207
  NSLog(@"🆕 Added new button to Screen %ld overlay - total subviews now: %lu", targetScreenIndex, [targetOverlay.contentView subviews].count);
1135
1208
  }
1136
-
1209
+
1210
+ ApplyStartRecordButtonIcon(targetSelectButton);
1211
+
1137
1212
  // Position buttons - Start Record in center of selected window
1138
1213
  if (targetSelectButton) {
1139
1214
  NSLog(@"🎯 Positioning button on Screen %ld - current frame: (%.0f,%.0f,%.0f,%.0f)", targetScreenIndex,
@@ -1736,9 +1811,11 @@ bool startScreenSelection() {
1736
1811
  value:[NSColor whiteColor]
1737
1812
  range:NSMakeRange(0, [titleString length])];
1738
1813
  [selectButton setAttributedTitle:titleString];
1739
-
1814
+
1815
+ ApplyStartRecordButtonIcon(selectButton);
1816
+
1740
1817
  // Clean button - no shadows or highlights
1741
-
1818
+
1742
1819
  // Set button target and action (reuse global delegate)
1743
1820
  if (!g_delegate) {
1744
1821
  g_delegate = [[WindowSelectorDelegate alloc] init];
@@ -2217,7 +2294,9 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
2217
2294
  value:[NSColor whiteColor]
2218
2295
  range:NSMakeRange(0, [titleString length])];
2219
2296
  [g_selectButton setAttributedTitle:titleString];
2220
-
2297
+
2298
+ ApplyStartRecordButtonIcon(g_selectButton);
2299
+
2221
2300
  // Create delegate for button action and timer
2222
2301
  g_delegate = [[WindowSelectorDelegate alloc] init];
2223
2302
  [g_selectButton setTarget:g_delegate];
@@ -2743,4 +2822,3 @@ extern "C" void showOverlays() {
2743
2822
  }
2744
2823
  });
2745
2824
  }
2746
-