node-mac-recorder 1.4.0 โ†’ 1.5.0

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.
@@ -334,15 +334,15 @@ if (!permissions.screenRecording) {
334
334
 
335
335
  ## ๐ŸŒŸ GeliลŸmiลŸ ร–rnekler
336
336
 
337
- ### Auto Bring-to-Front (Otomatik Focus)
337
+ ### Auto Bring-to-Front (DEFAULT - Otomatik Focus)
338
338
  ```javascript
339
339
  const WindowSelector = require('./window-selector');
340
340
 
341
341
  async function autoBringToFront() {
342
342
  const selector = new WindowSelector();
343
343
 
344
- // Otomatik focus modunu aktif et
345
- selector.setBringToFrontEnabled(true);
344
+ // Auto bring-to-front varsayฤฑlan olarak Aร‡IK
345
+ // (Kapatmak iรงin: selector.setBringToFrontEnabled(false))
346
346
 
347
347
  selector.on('windowEntered', (window) => {
348
348
  console.log(`๐Ÿ” Auto-focused: ${window.appName} - "${window.title}"`);
@@ -350,6 +350,7 @@ async function autoBringToFront() {
350
350
 
351
351
  await selector.startSelection();
352
352
  console.log('๐Ÿ–ฑ๏ธ Move cursor over windows - they will come to front automatically!');
353
+ console.log('๐Ÿ’ก Only the specific window focuses, not all windows of the app');
353
354
  }
354
355
  ```
355
356
 
package/debug-test.js ADDED
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+
3
+ const WindowSelector = require('./window-selector');
4
+
5
+ async function debugTest() {
6
+ console.log('๐Ÿ” Debug Window Selector Test');
7
+ console.log('==============================\n');
8
+
9
+ const selector = new WindowSelector();
10
+
11
+ try {
12
+ // ฤฐzinleri kontrol et
13
+ console.log('๐Ÿ“‹ Checking permissions...');
14
+ const permissions = await selector.checkPermissions();
15
+ console.log('Permissions:', JSON.stringify(permissions, null, 2));
16
+
17
+ if (!permissions.screenRecording || !permissions.accessibility) {
18
+ console.log('\nโŒ MISSING PERMISSIONS!');
19
+ console.log('Please enable in System Preferences > Security & Privacy:');
20
+ console.log(' โœ“ Screen Recording - Add Terminal/your IDE');
21
+ console.log(' โœ“ Accessibility - Add Terminal/your IDE');
22
+ console.log('\nAfter enabling permissions, restart this test.');
23
+ return;
24
+ }
25
+
26
+ console.log('โœ… Permissions OK\n');
27
+
28
+ // Debug mode ile baลŸlat
29
+ console.log('๐Ÿš€ Starting selection with debug info...');
30
+ await selector.startSelection();
31
+
32
+ let windowCount = 0;
33
+
34
+ selector.on('windowEntered', (window) => {
35
+ windowCount++;
36
+ console.log(`\n[${windowCount}] ๐ŸŽฏ WINDOW DETECTED:`);
37
+ console.log(` App: ${window.appName}`);
38
+ console.log(` Title: "${window.title}"`);
39
+ console.log(` ID: ${window.id}`);
40
+ console.log(` Position: (${window.x}, ${window.y})`);
41
+ console.log(` Size: ${window.width} ร— ${window.height}`);
42
+ console.log(` ๐Ÿ” Should auto-focus now...`);
43
+ });
44
+
45
+ selector.on('windowLeft', (window) => {
46
+ console.log(`\n๐Ÿšช LEFT WINDOW: ${window.appName} - "${window.title}"`);
47
+ });
48
+
49
+ selector.on('error', (error) => {
50
+ console.error('\nโŒ ERROR:', error.message);
51
+ });
52
+
53
+ console.log('๐Ÿ“‹ Test Instructions:');
54
+ console.log(' 1. Move cursor over different application windows');
55
+ console.log(' 2. You should see:');
56
+ console.log(' - Blue overlay rectangle around windows');
57
+ console.log(' - "Select Window" button in center');
58
+ console.log(' - Windows automatically coming to front');
59
+ console.log(' 3. If overlay not visible, check permissions');
60
+ console.log(' 4. Press Ctrl+C to exit\n');
61
+ console.log('๐Ÿ–ฑ๏ธ START MOVING CURSOR NOW...\n');
62
+
63
+ // Status monitoring
64
+ let statusCount = 0;
65
+ setInterval(() => {
66
+ statusCount++;
67
+ const status = selector.getStatus();
68
+
69
+ if (statusCount % 50 === 0) { // Every 5 seconds
70
+ console.log(`โฑ๏ธ Status Check #${statusCount/50}:`);
71
+ console.log(` - Selecting: ${status.isSelecting}`);
72
+ console.log(` - Windows found: ${status.nativeStatus?.windowCount || 0}`);
73
+ console.log(` - Overlay active: ${status.nativeStatus?.hasOverlay || false}`);
74
+ if (status.nativeStatus?.currentWindow) {
75
+ console.log(` - Current: ${status.nativeStatus.currentWindow.appName}`);
76
+ }
77
+ console.log('');
78
+ }
79
+ }, 100);
80
+
81
+ } catch (error) {
82
+ console.error('โŒ Fatal Error:', error.message);
83
+ console.error(error.stack);
84
+ }
85
+ }
86
+
87
+ // Handle Ctrl+C gracefully
88
+ process.on('SIGINT', async () => {
89
+ console.log('\n\n๐Ÿ›‘ Stopping debug test...');
90
+ process.exit(0);
91
+ });
92
+
93
+ if (require.main === module) {
94
+ debugTest();
95
+ }
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env node
2
+
3
+ const WindowSelector = require('./window-selector');
4
+
5
+ async function testDefaultAutoBringToFront() {
6
+ console.log('๐Ÿ” Default Auto Bring-To-Front Test');
7
+ console.log('====================================\n');
8
+
9
+ const selector = new WindowSelector();
10
+
11
+ try {
12
+ console.log('๐Ÿš€ Starting window selector with DEFAULT auto bring-to-front...');
13
+ console.log('(Auto bring-to-front is now enabled by default)\n');
14
+
15
+ console.log('๐Ÿ“‹ Instructions:');
16
+ console.log(' โ€ข Move cursor over different windows');
17
+ console.log(' โ€ข Each window should automatically come to front');
18
+ console.log(' โ€ข Only the specific window should focus (not whole app)');
19
+ console.log(' โ€ข Press D to disable auto mode');
20
+ console.log(' โ€ข Press E to re-enable auto mode');
21
+ console.log(' โ€ข Press Ctrl+C to exit\n');
22
+
23
+ let windowCount = 0;
24
+ let lastWindowId = null;
25
+
26
+ selector.on('windowEntered', (window) => {
27
+ if (window.id !== lastWindowId) {
28
+ windowCount++;
29
+ console.log(`[${windowCount}] ๐ŸŽฏ WINDOW: ${window.appName} - "${window.title}"`);
30
+ console.log(` ๐Ÿ“ Position: (${window.x}, ${window.y})`);
31
+ console.log(` ๐Ÿ“ Size: ${window.width} ร— ${window.height}`);
32
+ console.log(` ๐Ÿ” Should auto-focus THIS specific window only!`);
33
+ lastWindowId = window.id;
34
+ }
35
+ });
36
+
37
+ selector.on('windowLeft', (window) => {
38
+ console.log(`๐Ÿšช Left: ${window.appName} - "${window.title}"\n`);
39
+ });
40
+
41
+ // Keyboard controls
42
+ const readline = require('readline');
43
+ readline.emitKeypressEvents(process.stdin);
44
+ if (process.stdin.isTTY) {
45
+ process.stdin.setRawMode(true);
46
+ }
47
+
48
+ process.stdin.on('keypress', async (str, key) => {
49
+ if (key.name === 'd') {
50
+ console.log('\n๐Ÿ”„ Disabling auto bring-to-front...');
51
+ selector.setBringToFrontEnabled(false);
52
+ console.log(' โœ… Auto mode OFF - Windows will not auto-focus');
53
+ } else if (key.name === 'e') {
54
+ console.log('\n๐Ÿ”„ Enabling auto bring-to-front...');
55
+ selector.setBringToFrontEnabled(true);
56
+ console.log(' โœ… Auto mode ON - Windows will auto-focus again');
57
+ } else if (key.ctrl && key.name === 'c') {
58
+ console.log('\n\n๐Ÿ›‘ Stopping...');
59
+ console.log(`๐Ÿ“Š Total windows encountered: ${windowCount}`);
60
+ await selector.cleanup();
61
+ process.exit(0);
62
+ }
63
+ });
64
+
65
+ await selector.startSelection();
66
+
67
+ // Status update every 10 seconds
68
+ setInterval(() => {
69
+ console.log(`\nโฑ๏ธ Status: ${windowCount} windows encountered so far`);
70
+ console.log(' (Continue moving cursor over windows to test auto-focus)');
71
+ }, 10000);
72
+
73
+ // Keep running
74
+ setInterval(() => {}, 1000);
75
+
76
+ } catch (error) {
77
+ console.error('โŒ Error:', error.message);
78
+ console.error(error.stack);
79
+ } finally {
80
+ await selector.cleanup();
81
+ }
82
+ }
83
+
84
+ if (require.main === module) {
85
+ testDefaultAutoBringToFront();
86
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-mac-recorder",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Native macOS screen recording package for Node.js applications",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -35,8 +35,8 @@ bool bringWindowToFront(int windowId);
35
35
  self = [super initWithFrame:frameRect];
36
36
  if (self) {
37
37
  self.wantsLayer = YES;
38
- self.layer.backgroundColor = [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.5] CGColor];
39
- self.layer.borderColor = [[NSColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.9] CGColor];
38
+ self.layer.backgroundColor = [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.6] CGColor];
39
+ self.layer.borderColor = [[NSColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:0.9] CGColor];
40
40
  self.layer.borderWidth = 5.0;
41
41
  self.layer.cornerRadius = 8.0;
42
42
  }
@@ -49,11 +49,11 @@ bool bringWindowToFront(int windowId);
49
49
  if (!self.windowInfo) return;
50
50
 
51
51
  // Background with transparency
52
- [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.5] setFill];
52
+ [[NSColor colorWithRed:0.0 green:0.5 blue:1.0 alpha:0.6] setFill];
53
53
  NSRectFill(dirtyRect);
54
54
 
55
55
  // Border
56
- [[NSColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.9] setStroke];
56
+ [[NSColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:0.9] setStroke];
57
57
  NSBezierPath *border = [NSBezierPath bezierPathWithRoundedRect:self.bounds xRadius:8 yRadius:8];
58
58
  [border setLineWidth:3.0];
59
59
  [border stroke];
@@ -67,14 +67,14 @@ bool bringWindowToFront(int windowId);
67
67
  [style setAlignment:NSTextAlignmentCenter];
68
68
 
69
69
  NSDictionary *attributes = @{
70
- NSFontAttributeName: [NSFont systemFontOfSize:14 weight:NSFontWeightMedium],
70
+ NSFontAttributeName: [NSFont systemFontOfSize:21 weight:NSFontWeightMedium],
71
71
  NSForegroundColorAttributeName: [NSColor whiteColor],
72
72
  NSParagraphStyleAttributeName: style,
73
73
  NSStrokeColorAttributeName: [NSColor blackColor],
74
74
  NSStrokeWidthAttributeName: @(-2.0)
75
75
  };
76
76
 
77
- NSRect textRect = NSMakeRect(10, self.bounds.size.height - 60, self.bounds.size.width - 20, 50);
77
+ NSRect textRect = NSMakeRect(10, self.bounds.size.height - 90, self.bounds.size.width - 20, 80);
78
78
  [infoText drawInRect:textRect withAttributes:attributes];
79
79
  }
80
80
 
@@ -445,12 +445,26 @@ Napi::Value StartWindowSelection(const Napi::CallbackInfo& info) {
445
445
  g_overlayView = [[WindowSelectorOverlayView alloc] initWithFrame:initialFrame];
446
446
  [g_overlayWindow setContentView:g_overlayView];
447
447
 
448
- // Create select button
449
- g_selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 120, 40)];
448
+ // Create select button with blue theme
449
+ g_selectButton = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 140, 50)];
450
450
  [g_selectButton setTitle:@"Select Window"];
451
451
  [g_selectButton setButtonType:NSButtonTypeMomentaryPushIn];
452
452
  [g_selectButton setBezelStyle:NSBezelStyleRounded];
453
- [g_selectButton setFont:[NSFont systemFontOfSize:14 weight:NSFontWeightMedium]];
453
+ [g_selectButton setFont:[NSFont systemFontOfSize:16 weight:NSFontWeightSemibold]];
454
+
455
+ // Blue themed button styling
456
+ [g_selectButton setWantsLayer:YES];
457
+ [g_selectButton.layer setBackgroundColor:[[NSColor colorWithRed:0.0 green:0.4 blue:0.8 alpha:0.9] CGColor]];
458
+ [g_selectButton.layer setCornerRadius:8.0];
459
+ [g_selectButton.layer setBorderColor:[[NSColor colorWithRed:0.0 green:0.3 blue:0.7 alpha:1.0] CGColor]];
460
+ [g_selectButton.layer setBorderWidth:2.0];
461
+ [g_selectButton setContentTintColor:[NSColor whiteColor]];
462
+
463
+ // Add shadow for better visibility
464
+ [g_selectButton.layer setShadowColor:[[NSColor blackColor] CGColor]];
465
+ [g_selectButton.layer setShadowOffset:NSMakeSize(0, -2)];
466
+ [g_selectButton.layer setShadowRadius:4.0];
467
+ [g_selectButton.layer setShadowOpacity:0.3];
454
468
 
455
469
  // Create delegate for button action and timer
456
470
  g_delegate = [[WindowSelectorDelegate alloc] init];
@@ -240,7 +240,10 @@ class WindowSelector extends EventEmitter {
240
240
  setBringToFrontEnabled(enabled) {
241
241
  try {
242
242
  nativeBinding.setBringToFrontEnabled(enabled);
243
- console.log(`๐Ÿ”„ Auto bring-to-front: ${enabled ? 'ENABLED' : 'DISABLED'}`);
243
+ // Only log if explicitly setting, not on startup
244
+ if (arguments.length > 0) {
245
+ console.log(`๐Ÿ”„ Auto bring-to-front: ${enabled ? 'ENABLED' : 'DISABLED'}`);
246
+ }
244
247
  } catch (error) {
245
248
  throw new Error(`Failed to set bring to front: ${error.message}`);
246
249
  }