node-mac-recorder 2.5.3 → 2.5.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 +62 -80
package/package.json
CHANGED
package/src/window_selector.mm
CHANGED
|
@@ -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.
|
|
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
|
-
// 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
|
-
[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.
|
|
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
|
-
// 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
|
-
[border stroke];
|
|
167
|
-
|
|
168
157
|
// Text will be handled by separate label above button
|
|
169
158
|
}
|
|
170
159
|
|
|
@@ -521,7 +510,7 @@ 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:
|
|
513
|
+
[appIconView.layer setCornerRadius:8.0];
|
|
525
514
|
[appIconView.layer setMasksToBounds:YES];
|
|
526
515
|
[appIconView.layer setBackgroundColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.3] CGColor]]; // Debug background
|
|
527
516
|
[g_overlayWindow.contentView addSubview:appIconView];
|
|
@@ -577,6 +566,20 @@ void updateOverlay() {
|
|
|
577
566
|
NSLog(@"🎯 Positioning app icon at: (%.0f, %.0f) for window size: (%.0f, %.0f)",
|
|
578
567
|
iconCenter.x, iconCenter.y, (float)width, (float)height);
|
|
579
568
|
|
|
569
|
+
// Add fast horizontal floating animation after positioning
|
|
570
|
+
[appIconView.layer removeAnimationForKey:@"floatAnimationX"];
|
|
571
|
+
[appIconView.layer removeAnimationForKey:@"floatAnimationY"];
|
|
572
|
+
|
|
573
|
+
// Faster horizontal float animation only
|
|
574
|
+
CABasicAnimation *floatAnimationX = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
|
|
575
|
+
floatAnimationX.fromValue = @(-4.0);
|
|
576
|
+
floatAnimationX.toValue = @(4.0);
|
|
577
|
+
floatAnimationX.duration = 2.5; // Faster animation
|
|
578
|
+
floatAnimationX.repeatCount = HUGE_VALF;
|
|
579
|
+
floatAnimationX.autoreverses = YES;
|
|
580
|
+
floatAnimationX.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
|
581
|
+
[appIconView.layer addAnimation:floatAnimationX forKey:@"floatAnimationX"];
|
|
582
|
+
|
|
580
583
|
// Position info label at overlay center, above button
|
|
581
584
|
NSPoint labelCenter = NSMakePoint(
|
|
582
585
|
(width - [infoLabel frame].size.width) / 2, // Center horizontally
|
|
@@ -821,22 +824,23 @@ bool startScreenSelection() {
|
|
|
821
824
|
[overlayView setScreenInfo:screenInfo];
|
|
822
825
|
[overlayWindow setContentView:overlayView];
|
|
823
826
|
|
|
824
|
-
// Create select button
|
|
825
|
-
NSButton *selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0,
|
|
827
|
+
// Create select button with more padding
|
|
828
|
+
NSButton *selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
|
|
826
829
|
[selectButton setTitle:@"Start Record"];
|
|
827
830
|
[selectButton setButtonType:NSButtonTypeMomentaryPushIn];
|
|
828
|
-
[selectButton
|
|
829
|
-
[selectButton setFont:[NSFont systemFontOfSize:16 weight:
|
|
831
|
+
[selectButton setBordered:NO];
|
|
832
|
+
[selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightRegular]];
|
|
830
833
|
[selectButton setTag:i]; // Set screen index as tag
|
|
831
834
|
|
|
832
|
-
// Modern button styling with purple
|
|
835
|
+
// Modern button styling with purple tone
|
|
833
836
|
[selectButton setWantsLayer:YES];
|
|
834
|
-
[selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.
|
|
835
|
-
[selectButton.layer setCornerRadius:
|
|
837
|
+
[selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.55 green:0.3 blue:0.75 alpha:0.95] CGColor]];
|
|
838
|
+
[selectButton.layer setCornerRadius:8.0];
|
|
836
839
|
[selectButton.layer setBorderWidth:0.0];
|
|
837
840
|
|
|
838
|
-
//
|
|
839
|
-
[selectButton setFont:[NSFont systemFontOfSize:
|
|
841
|
+
// Clean white text - normal weight
|
|
842
|
+
[selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightRegular]];
|
|
843
|
+
[selectButton setTitle:@"Start Record"];
|
|
840
844
|
NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]
|
|
841
845
|
initWithString:[selectButton title]];
|
|
842
846
|
[titleString addAttribute:NSForegroundColorAttributeName
|
|
@@ -844,19 +848,7 @@ bool startScreenSelection() {
|
|
|
844
848
|
range:NSMakeRange(0, [titleString length])];
|
|
845
849
|
[selectButton setAttributedTitle:titleString];
|
|
846
850
|
|
|
847
|
-
//
|
|
848
|
-
[selectButton.layer setShadowColor:[[NSColor colorWithRed:0.4 green:0.2 blue:0.6 alpha:0.8] CGColor]];
|
|
849
|
-
[selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
|
|
850
|
-
[selectButton.layer setShadowRadius:8.0];
|
|
851
|
-
[selectButton.layer setShadowOpacity:0.4];
|
|
852
|
-
|
|
853
|
-
// Add subtle inner highlight - purple tone
|
|
854
|
-
CALayer *highlightLayer = [CALayer layer];
|
|
855
|
-
[highlightLayer setFrame:CGRectMake(0, selectButton.frame.size.height * 0.6,
|
|
856
|
-
selectButton.frame.size.width, selectButton.frame.size.height * 0.4)];
|
|
857
|
-
[highlightLayer setBackgroundColor:[[NSColor colorWithRed:0.6 green:0.4 blue:0.9 alpha:0.3] CGColor]];
|
|
858
|
-
[highlightLayer setCornerRadius:14.0];
|
|
859
|
-
[selectButton.layer addSublayer:highlightLayer];
|
|
851
|
+
// Clean button - no shadows or highlights
|
|
860
852
|
|
|
861
853
|
// Set button target and action (reuse global delegate)
|
|
862
854
|
if (!g_delegate) {
|
|
@@ -869,17 +861,17 @@ bool startScreenSelection() {
|
|
|
869
861
|
NSButton *screenCancelButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 40)];
|
|
870
862
|
[screenCancelButton setTitle:@"Cancel"];
|
|
871
863
|
[screenCancelButton setButtonType:NSButtonTypeMomentaryPushIn];
|
|
872
|
-
[screenCancelButton
|
|
864
|
+
[screenCancelButton setBordered:NO];
|
|
873
865
|
[screenCancelButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightMedium]];
|
|
874
866
|
|
|
875
|
-
// Modern cancel button styling
|
|
867
|
+
// Modern cancel button styling - darker gray, clean
|
|
876
868
|
[screenCancelButton setWantsLayer:YES];
|
|
877
|
-
[screenCancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.
|
|
878
|
-
[screenCancelButton.layer setCornerRadius:
|
|
869
|
+
[screenCancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.35 green:0.35 blue:0.4 alpha:0.9] CGColor]];
|
|
870
|
+
[screenCancelButton.layer setCornerRadius:8.0];
|
|
879
871
|
[screenCancelButton.layer setBorderWidth:0.0];
|
|
880
872
|
|
|
881
|
-
//
|
|
882
|
-
[screenCancelButton setFont:[NSFont systemFontOfSize:15 weight:
|
|
873
|
+
// Clean white text for cancel button
|
|
874
|
+
[screenCancelButton setFont:[NSFont systemFontOfSize:15 weight:NSFontWeightRegular]];
|
|
883
875
|
NSMutableAttributedString *screenCancelTitleString = [[NSMutableAttributedString alloc]
|
|
884
876
|
initWithString:[screenCancelButton title]];
|
|
885
877
|
[screenCancelTitleString addAttribute:NSForegroundColorAttributeName
|
|
@@ -887,12 +879,6 @@ bool startScreenSelection() {
|
|
|
887
879
|
range:NSMakeRange(0, [screenCancelTitleString length])];
|
|
888
880
|
[screenCancelButton setAttributedTitle:screenCancelTitleString];
|
|
889
881
|
|
|
890
|
-
// Enhanced shadow for cancel button
|
|
891
|
-
[screenCancelButton.layer setShadowColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.8] CGColor]];
|
|
892
|
-
[screenCancelButton.layer setShadowOffset:NSMakeSize(0, -2)];
|
|
893
|
-
[screenCancelButton.layer setShadowRadius:4.0];
|
|
894
|
-
[screenCancelButton.layer setShadowOpacity:0.3];
|
|
895
|
-
|
|
896
882
|
[screenCancelButton setTarget:g_delegate];
|
|
897
883
|
[screenCancelButton setAction:@selector(cancelButtonClicked:)];
|
|
898
884
|
|
|
@@ -910,7 +896,7 @@ bool startScreenSelection() {
|
|
|
910
896
|
NSImageView *screenIconView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, 96, 96)];
|
|
911
897
|
[screenIconView setImageScaling:NSImageScaleProportionallyUpOrDown];
|
|
912
898
|
[screenIconView setWantsLayer:YES];
|
|
913
|
-
[screenIconView.layer setCornerRadius:
|
|
899
|
+
[screenIconView.layer setCornerRadius:8.0];
|
|
914
900
|
[screenIconView.layer setMasksToBounds:YES];
|
|
915
901
|
|
|
916
902
|
// Set display icon
|
|
@@ -937,6 +923,16 @@ bool startScreenSelection() {
|
|
|
937
923
|
);
|
|
938
924
|
[screenIconView setFrameOrigin:iconCenter];
|
|
939
925
|
|
|
926
|
+
// Add fast horizontal floating animation to screen icon
|
|
927
|
+
CABasicAnimation *screenFloatAnimationX = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
|
|
928
|
+
screenFloatAnimationX.fromValue = @(-4.0);
|
|
929
|
+
screenFloatAnimationX.toValue = @(4.0);
|
|
930
|
+
screenFloatAnimationX.duration = 2.8; // Slightly different timing for variety
|
|
931
|
+
screenFloatAnimationX.repeatCount = HUGE_VALF;
|
|
932
|
+
screenFloatAnimationX.autoreverses = YES;
|
|
933
|
+
screenFloatAnimationX.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
|
934
|
+
[screenIconView.layer addAnimation:screenFloatAnimationX forKey:@"floatAnimationX"];
|
|
935
|
+
|
|
940
936
|
// Position info label at screen center, above button
|
|
941
937
|
NSPoint labelCenter = NSMakePoint(
|
|
942
938
|
(screenFrame.size.width - [screenInfoLabel frame].size.width) / 2, // Center horizontally
|
|
@@ -1107,21 +1103,20 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1107
1103
|
g_overlayView = [[WindowSelectorOverlayView alloc] initWithFrame:initialFrame];
|
|
1108
1104
|
[g_overlayWindow setContentView:g_overlayView];
|
|
1109
1105
|
|
|
1110
|
-
// Create select button with
|
|
1111
|
-
g_selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0,
|
|
1106
|
+
// Create select button with purple theme
|
|
1107
|
+
g_selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 200, 60)];
|
|
1112
1108
|
[g_selectButton setTitle:@"Start Record"];
|
|
1113
1109
|
[g_selectButton setButtonType:NSButtonTypeMomentaryPushIn];
|
|
1114
|
-
[g_selectButton
|
|
1115
|
-
[g_selectButton setFont:[NSFont systemFontOfSize:16 weight:
|
|
1110
|
+
[g_selectButton setBordered:NO];
|
|
1111
|
+
[g_selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightRegular]];
|
|
1116
1112
|
|
|
1117
|
-
// Modern button styling with purple
|
|
1113
|
+
// Modern button styling with purple tone
|
|
1118
1114
|
[g_selectButton setWantsLayer:YES];
|
|
1119
|
-
[g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.
|
|
1120
|
-
[g_selectButton.layer setCornerRadius:
|
|
1115
|
+
[g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.55 green:0.3 blue:0.75 alpha:0.95] CGColor]];
|
|
1116
|
+
[g_selectButton.layer setCornerRadius:8.0];
|
|
1121
1117
|
[g_selectButton.layer setBorderWidth:0.0];
|
|
1122
1118
|
|
|
1123
|
-
//
|
|
1124
|
-
[g_selectButton setFont:[NSFont systemFontOfSize:17 weight:NSFontWeightSemibold]];
|
|
1119
|
+
// Clean white text - normal weight
|
|
1125
1120
|
NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc]
|
|
1126
1121
|
initWithString:[g_selectButton title]];
|
|
1127
1122
|
[titleString addAttribute:NSForegroundColorAttributeName
|
|
@@ -1129,12 +1124,6 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1129
1124
|
range:NSMakeRange(0, [titleString length])];
|
|
1130
1125
|
[g_selectButton setAttributedTitle:titleString];
|
|
1131
1126
|
|
|
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]];
|
|
1134
|
-
[g_selectButton.layer setShadowOffset:NSMakeSize(0, -3)];
|
|
1135
|
-
[g_selectButton.layer setShadowRadius:8.0];
|
|
1136
|
-
[g_selectButton.layer setShadowOpacity:0.4];
|
|
1137
|
-
|
|
1138
1127
|
// Create delegate for button action and timer
|
|
1139
1128
|
g_delegate = [[WindowSelectorDelegate alloc] init];
|
|
1140
1129
|
[g_selectButton setTarget:g_delegate];
|
|
@@ -1147,17 +1136,16 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1147
1136
|
NSButton *cancelButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 40)];
|
|
1148
1137
|
[cancelButton setTitle:@"Cancel"];
|
|
1149
1138
|
[cancelButton setButtonType:NSButtonTypeMomentaryPushIn];
|
|
1150
|
-
[cancelButton
|
|
1151
|
-
[cancelButton setFont:[NSFont systemFontOfSize:14 weight:
|
|
1139
|
+
[cancelButton setBordered:NO];
|
|
1140
|
+
[cancelButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightRegular]];
|
|
1152
1141
|
|
|
1153
|
-
// Modern cancel button styling
|
|
1142
|
+
// Modern cancel button styling - darker gray, clean
|
|
1154
1143
|
[cancelButton setWantsLayer:YES];
|
|
1155
|
-
[cancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.
|
|
1156
|
-
[cancelButton.layer setCornerRadius:
|
|
1144
|
+
[cancelButton.layer setBackgroundColor:[[NSColor colorWithRed:0.35 green:0.35 blue:0.4 alpha:0.9] CGColor]];
|
|
1145
|
+
[cancelButton.layer setCornerRadius:8.0];
|
|
1157
1146
|
[cancelButton.layer setBorderWidth:0.0];
|
|
1158
1147
|
|
|
1159
|
-
//
|
|
1160
|
-
[cancelButton setFont:[NSFont systemFontOfSize:15 weight:NSFontWeightMedium]];
|
|
1148
|
+
// Clean white text for cancel button
|
|
1161
1149
|
NSMutableAttributedString *cancelTitleString = [[NSMutableAttributedString alloc]
|
|
1162
1150
|
initWithString:[cancelButton title]];
|
|
1163
1151
|
[cancelTitleString addAttribute:NSForegroundColorAttributeName
|
|
@@ -1165,12 +1153,6 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
|
|
|
1165
1153
|
range:NSMakeRange(0, [cancelTitleString length])];
|
|
1166
1154
|
[cancelButton setAttributedTitle:cancelTitleString];
|
|
1167
1155
|
|
|
1168
|
-
// Enhanced shadow for cancel button
|
|
1169
|
-
[cancelButton.layer setShadowColor:[[NSColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:0.8] CGColor]];
|
|
1170
|
-
[cancelButton.layer setShadowOffset:NSMakeSize(0, -2)];
|
|
1171
|
-
[cancelButton.layer setShadowRadius:4.0];
|
|
1172
|
-
[cancelButton.layer setShadowOpacity:0.3];
|
|
1173
|
-
|
|
1174
1156
|
[cancelButton setTarget:g_delegate];
|
|
1175
1157
|
[cancelButton setAction:@selector(cancelButtonClicked:)];
|
|
1176
1158
|
|