@livedesk/client 0.1.32 → 0.1.33

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.
@@ -341,6 +341,12 @@ function getStatus(options = {}) {
341
341
  freeBytes: freeMem,
342
342
  usedRatio: usedMemRatio
343
343
  },
344
+ screenCount: 1,
345
+ monitorCount: 1,
346
+ screens: {
347
+ count: 1,
348
+ displays: []
349
+ },
344
350
  disk: getRootDiskStatus(),
345
351
  gpu: acceleratorStatus.gpu,
346
352
  npu: acceleratorStatus.npu,
@@ -528,7 +534,11 @@ function readJpegDimensions(buffer) {
528
534
  return { width: 0, height: 0 };
529
535
  }
530
536
 
531
- async function captureNativeDesktopFrame(frameSeq) {
537
+ function normalizeMonitorIndex(value, fallback = 0) {
538
+ return clampInteger(value, 0, 63, fallback);
539
+ }
540
+
541
+ async function captureNativeDesktopFrame(frameSeq, monitorIndex = 0) {
532
542
  const screenshotModule = await import('node-screenshots');
533
543
  const Monitor = screenshotModule.Monitor || screenshotModule.default?.Monitor;
534
544
  if (!Monitor?.all) {
@@ -536,7 +546,8 @@ async function captureNativeDesktopFrame(frameSeq) {
536
546
  }
537
547
 
538
548
  const monitors = Monitor.all();
539
- const monitor = monitors.find(item => item?.isPrimary?.() === true) || monitors[0];
549
+ const selectedIndex = Math.max(0, Math.min(monitors.length - 1, normalizeMonitorIndex(monitorIndex)));
550
+ const monitor = monitors[selectedIndex] || monitors.find(item => item?.isPrimary?.() === true) || monitors[0];
540
551
  if (!monitor?.captureImage) {
541
552
  throw new Error('No capturable desktop monitor was found.');
542
553
  }
@@ -555,12 +566,14 @@ async function captureNativeDesktopFrame(frameSeq) {
555
566
  height: dimensions.height,
556
567
  mimeType: 'image/jpeg',
557
568
  data: buffer.toString('base64'),
569
+ monitorIndex: selectedIndex,
570
+ monitorCount: Math.max(1, monitors.length),
558
571
  capturedAt: new Date().toISOString()
559
572
  };
560
573
  }
561
574
 
562
575
  async function captureDesktopThumbnailFrame(payload, frameSeq) {
563
- return await captureNativeDesktopFrame(frameSeq);
576
+ return await captureNativeDesktopFrame(frameSeq, payload?.monitorIndex ?? payload?.screenIndex ?? payload?.displayIndex);
564
577
  }
565
578
 
566
579
  async function captureScreenFrame(options, payload, frameSeq, capability = 'thumbnail') {
@@ -749,6 +762,8 @@ function startLiveStream(socket, options, message, nextFrameSeq, activeStreams)
749
762
  capturedAt: frame.capturedAt,
750
763
  fps,
751
764
  mode: 'mode1-jpeg',
765
+ monitorIndex: frame.monitorIndex ?? 0,
766
+ monitorCount: frame.monitorCount ?? 1,
752
767
  droppedByAgent: stream.frameDrops,
753
768
  data: frame.data
754
769
  });
@@ -1054,6 +1069,9 @@ function connectOnce(options, deviceId) {
1054
1069
  status: true,
1055
1070
  thumbnail: options.thumbnailEnabled,
1056
1071
  liveStream: options.liveEnabled,
1072
+ monitorSelection: true,
1073
+ screenCount: 1,
1074
+ monitorCount: 1,
1057
1075
  control: false,
1058
1076
  audio: false,
1059
1077
  remoteAudio: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/client",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "LiveDesk local remote client",
5
5
  "type": "module",
6
6
  "bin": {