systeminformation 6.0.0-beta.10 → 6.0.0-beta.11

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/README.md CHANGED
@@ -400,6 +400,10 @@ On Windows, `si.displays()` reports physical monitors: in duplicate/mirror mode
400
400
  | | [0].currentResY | X | | X | X | | current pixel vertical |
401
401
  | | [0].positionX | X | | X | X | | display position X |
402
402
  | | [0].positionY | X | | X | X | | display position Y |
403
+ | | [0].workAreaResolutionX | X | | X | X | | working area (screen minus task bar / panels / menu bar and Dock) resolution X |
404
+ | | [0].workAreaResolutionY | X | | X | X | | working area resolution Y |
405
+ | | [0].workAreaPositionX | X | | X | X | | working area position X |
406
+ | | [0].workAreaPositionY | X | | X | X | | working area position Y |
403
407
  | | [0].currentRefreshRate | X | | X | X | | current screen refresh rate |
404
408
  | | [0].scale | | | | X | | DPI scaling factor, e.g. 1.5 |
405
409
 
@@ -1,5 +1,7 @@
1
1
  import type { UserData } from './types';
2
2
  export declare const darwinXcodeExists: () => Promise<boolean>;
3
+ export declare const USB_DATA_TYPES: string[];
4
+ export declare const spItems: (data: any, dataTypes: string | string[]) => any[];
3
5
  export declare const plistParser: (xmlStr: string, items?: boolean) => any;
4
6
  export declare const formatBssid: (s: string) => string;
5
7
  export declare const plistReader: (output: string) => {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseUsersDarwin = exports.plistReader = exports.formatBssid = exports.plistParser = exports.darwinXcodeExists = void 0;
3
+ exports.parseUsersDarwin = exports.plistReader = exports.formatBssid = exports.plistParser = exports.spItems = exports.USB_DATA_TYPES = exports.darwinXcodeExists = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const promises_1 = require("fs/promises");
6
6
  const datetime_1 = require("./datetime");
@@ -14,6 +14,22 @@ const darwinXcodeExists = async () => {
14
14
  };
15
15
  exports.darwinXcodeExists = darwinXcodeExists;
16
16
  const isProtoKey = (key) => key === '__proto__' || key === 'constructor' || key === 'prototype';
17
+ exports.USB_DATA_TYPES = ['SPUSBDataType', 'SPUSBHostDataType'];
18
+ const spItems = (data, dataTypes) => {
19
+ const types = Array.isArray(dataTypes) ? dataTypes : [dataTypes];
20
+ const result = [];
21
+ if (!Array.isArray(data)) {
22
+ return result;
23
+ }
24
+ for (const dataType of types) {
25
+ const section = data.find((s) => s && s._dataType === dataType);
26
+ if (section && Array.isArray(section._items)) {
27
+ result.push(...section._items);
28
+ }
29
+ }
30
+ return result;
31
+ };
32
+ exports.spItems = spItems;
17
33
  const plistParser = (xmlStr, items = true) => {
18
34
  const tags = ['array', 'dict', 'key', 'string', 'integer', 'date', 'real', 'data', 'boolean', 'arrayEmpty'];
19
35
  const startStr = '<plist version';
@@ -246,6 +246,10 @@ exports.initDisplay = {
246
246
  currentResY: null,
247
247
  positionX: 0,
248
248
  positionY: 0,
249
+ workAreaResolutionX: null,
250
+ workAreaResolutionY: null,
251
+ workAreaPositionX: null,
252
+ workAreaPositionY: null,
249
253
  currentRefreshRate: null,
250
254
  scale: null
251
255
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getUniqueMacAddresses = exports.getFQDN = void 0;
4
+ const node_child_process_1 = require("node:child_process");
4
5
  const node_os_1 = require("node:os");
5
6
  const const_1 = require("./const");
6
7
  const exec_1 = require("./exec");
@@ -33,16 +34,67 @@ const getFQDN = async () => {
33
34
  return (0, node_os_1.hostname)();
34
35
  };
35
36
  exports.getFQDN = getFQDN;
37
+ const MASKED_MACS = ['00:00:00:00:00:00', '02:00:00:00:00:00'];
38
+ const getMacAddressesSync = () => {
39
+ const result = {};
40
+ let iface = '';
41
+ let mac = '';
42
+ try {
43
+ if (const_1.LINUX) {
44
+ const lines = (0, node_child_process_1.execSync)('export LC_ALL=C; ip link show up; unset LC_ALL', { encoding: 'utf8' }).split('\n');
45
+ for (let i = 0; i < lines.length; i++) {
46
+ const line = lines[i];
47
+ if (line && line[0] !== ' ') {
48
+ const next = (lines[i + 1] || '').trim().split(' ');
49
+ if (next[0] === 'link/ether') {
50
+ iface = (line.split(' ')[1] || '').replace(/:$/, '');
51
+ mac = next[1] || '';
52
+ }
53
+ if (iface && mac) {
54
+ result[iface] = mac.trim();
55
+ iface = '';
56
+ mac = '';
57
+ }
58
+ }
59
+ }
60
+ }
61
+ else if (const_1.DARWIN || const_1.FREEBSD || const_1.NETBSD || const_1.OPENBSD) {
62
+ const lines = (0, node_child_process_1.execSync)('/sbin/ifconfig', { encoding: 'utf8' }).split('\n');
63
+ for (const line of lines) {
64
+ if (line && line[0] !== '\t' && line.indexOf(':') > 0) {
65
+ iface = line.split(':')[0];
66
+ }
67
+ else if (line.indexOf('\tether ') === 0) {
68
+ mac = line.split('\tether ')[1] || '';
69
+ if (iface && mac) {
70
+ result[iface] = mac.trim();
71
+ iface = '';
72
+ mac = '';
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ catch { }
79
+ return result;
80
+ };
36
81
  const getUniqueMacAddresses = () => {
37
82
  let macs = [];
38
83
  try {
39
84
  const interfaces = (0, node_os_1.networkInterfaces)();
85
+ let fallbackMacs = null;
40
86
  for (const dev in interfaces) {
41
87
  if (Object.keys(interfaces).includes(dev)) {
42
88
  interfaces[dev]?.forEach((details) => {
43
- if (details?.mac && details.mac !== '00:00:00:00:00:00') {
44
- const mac = details.mac.toLowerCase();
45
- if (macs.indexOf(mac) === -1) {
89
+ if (details?.mac) {
90
+ let mac = details.mac.toLowerCase();
91
+ if (MASKED_MACS.includes(mac)) {
92
+ if (fallbackMacs === null) {
93
+ fallbackMacs = getMacAddressesSync();
94
+ }
95
+ mac = (fallbackMacs[dev] || '').toLowerCase();
96
+ }
97
+ if (mac && !MASKED_MACS.includes(mac) && macs.indexOf(mac) === -1) {
46
98
  macs.push(mac);
47
99
  }
48
100
  }
@@ -1670,7 +1670,8 @@ const graphicsMetalVersion = (id) => {
1670
1670
  spdisplays_metalfeaturesetfamily14: 'family1_v4',
1671
1671
  spdisplays_metalfeaturesetfamily21: 'family2_v1'
1672
1672
  };
1673
- return families[id] || '';
1673
+ const version = /^spdisplays_metal(\d+)$/.exec(id);
1674
+ return families[id] || (version ? version[1] : '');
1674
1675
  };
1675
1676
  exports.graphicsMetalVersion = graphicsMetalVersion;
1676
1677
  exports.winProcessStatus = {
@@ -845,6 +845,10 @@ export type DisplayData = {
845
845
  currentResY: number | null;
846
846
  positionX: number;
847
847
  positionY: number;
848
+ workAreaResolutionX: number | null;
849
+ workAreaResolutionY: number | null;
850
+ workAreaPositionX: number | null;
851
+ workAreaPositionY: number | null;
848
852
  currentRefreshRate: number | null;
849
853
  scale: number | null;
850
854
  };
@@ -1,2 +1,2 @@
1
- import { BatteryObject } from '../common/types';
1
+ import type { BatteryObject } from '../common/types';
2
2
  export declare const battery: () => Promise<BatteryObject[]>;
@@ -7,7 +7,12 @@ const exec_1 = require("../common/exec");
7
7
  const parseBatteryObject = (data) => {
8
8
  const defaults = (0, common_1.cloneObj)(defaults_1.initBatteryResult);
9
9
  data = data || '';
10
- const lines = data.replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n');
10
+ const lines = data
11
+ .replace(/^[ |]+/gm, '')
12
+ .replace(/ +/g, '')
13
+ .replace(/"+/g, '')
14
+ .replace(/-/g, '')
15
+ .split('\n');
11
16
  let percent = null;
12
17
  const line = (0, common_1.getValue)(lines, 'internal', 'Battery');
13
18
  const parts = line.split(';');
@@ -21,9 +26,14 @@ const parseBatteryObject = (data) => {
21
26
  const acConnected = parts && parts[1] ? parts[1].trim() !== 'discharging' : false;
22
27
  const voltage = parseInt('0' + (0, common_1.getValue)(lines, 'voltage', '='), 10) / 1000.0;
23
28
  const capacityUnit = voltage ? 'mWh' : 'mAh';
24
- const maxCapacity = Math.round(parseInt('0' + (0, common_1.getValue)(lines, 'applerawmaxcapacity', '='), 10) * (voltage || 1));
25
- const currentCapacity = Math.round(parseInt('0' + (0, common_1.getValue)(lines, 'applerawcurrentcapacity', '='), 10) * (voltage || 1));
26
- const designedCapacity = Math.round(parseInt('0' + (0, common_1.getValue)(lines, 'DesignCapacity', '='), 10) * (voltage || 1));
29
+ const batteryData = (0, common_1.getValue)(lines, 'BatteryData', '=').replace(/^\{/, '').replace(/\}$/, '').split(',');
30
+ const maxCapacity = Math.round(parseInt('0' +
31
+ ((0, common_1.getValue)(lines, 'AppleRawMaxCapacity', '=') ||
32
+ (0, common_1.getValue)(lines, 'NominalChargeCapacity', '=') ||
33
+ (0, common_1.getValue)(batteryData, 'FullChargeCapacity', '=') ||
34
+ (0, common_1.getValue)(batteryData, 'NominalChargeCapacity', '=')), 10) * (voltage || 1));
35
+ const currentCapacity = Math.round(parseInt('0' + ((0, common_1.getValue)(lines, 'AppleRawCurrentCapacity', '=') || (0, common_1.getValue)(batteryData, 'RemainingCapacity', '=')), 10) * (voltage || 1));
36
+ const designedCapacity = Math.round(parseInt('0' + ((0, common_1.getValue)(lines, 'DesignCapacity', '=') || (0, common_1.getValue)(batteryData, 'DesignCapacity', '=')), 10) * (voltage || 1));
27
37
  let hasBattery = defaults.hasBattery;
28
38
  let type = defaults.type;
29
39
  let timeRemaining = defaults.timeRemaining;
@@ -59,7 +69,7 @@ const parseBatteryObject = (data) => {
59
69
  };
60
70
  const battery = async () => {
61
71
  await (0, common_1.nextTick)();
62
- const { stdout } = await (0, exec_1.execSave)('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|DeviceName|BatterySerialNumber|Serial|TimeRemaining|Voltage"; pmset -g batt | grep %');
72
+ const { stdout } = await (0, exec_1.execSave)('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|DesignCapacity|MaxCapacity|CurrentCapacity|DeviceName|BatterySerialNumber|Serial|TimeRemaining|Voltage|BatteryData|NominalChargeCapacity"; pmset -g batt | grep %');
63
73
  return parseBatteryObject(stdout);
64
74
  };
65
75
  exports.battery = battery;
@@ -40,10 +40,10 @@ const parseUsb = (data) => {
40
40
  const camera = async () => {
41
41
  await (0, common_1.nextTick)();
42
42
  try {
43
- const { stdout } = await (0, exec_1.exec)('system_profiler SPCameraDataType SPUSBDataType -xml');
43
+ const { stdout } = await (0, exec_1.exec)('system_profiler SPCameraDataType SPUSBDataType SPUSBHostDataType -xml');
44
44
  const data = (0, darwin_1.plistParser)(stdout, false);
45
- const cameraData = data.length >= 2 && data[0]._items ? data[0]._items : [];
46
- const usbData = data.length >= 2 && data[1]._items ? data[1]._items : [];
45
+ const cameraData = (0, darwin_1.spItems)(data, 'SPCameraDataType');
46
+ const usbData = (0, darwin_1.spItems)(data, darwin_1.USB_DATA_TYPES);
47
47
  let result = parseCamera(cameraData);
48
48
  result = result.concat(parseUsb(usbData));
49
49
  return result;
@@ -20,13 +20,13 @@ const diskLayout = async () => {
20
20
  cmdFullSmart += `${cmdFullSmart ? 'printf ",";' : ''}smartctl -a -j ${bsdName};`;
21
21
  };
22
22
  try {
23
- ({ stdout } = await (0, exec_1.exec)(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPStorageDataType -xml`, { maxBuffer: const_1.MAX_BUFFER_SIZE }));
23
+ ({ stdout } = await (0, exec_1.exec)(`system_profiler SPSerialATADataType SPNVMeDataType SPUSBDataType SPUSBHostDataType SPStorageDataType -xml`, { maxBuffer: const_1.MAX_BUFFER_SIZE }));
24
24
  const data = (0, darwin_1.plistParser)(stdout, false);
25
- const diskSATA = data.length >= 4 && data[0]._items ? data[0]._items : [];
26
- const diskNVME = data.length >= 4 && data[1]._items ? data[1]._items : [];
27
- const diskUSB = data.length >= 4 && data[2]._items ? data[2]._items : [];
28
- const diskLine = data.length >= 4 && data[3]._items ? data[3]._items : [];
29
- if (diskSATA?.length && diskSATA._items) {
25
+ const diskSATA = (0, darwin_1.spItems)(data, 'SPSerialATADataType');
26
+ const diskNVME = (0, darwin_1.spItems)(data, 'SPNVMeDataType');
27
+ const diskUSB = (0, darwin_1.spItems)(data, darwin_1.USB_DATA_TYPES);
28
+ const diskLine = (0, darwin_1.spItems)(data, 'SPStorageDataType');
29
+ if (diskSATA?.length) {
30
30
  diskSATA.forEach((controller) => {
31
31
  if (controller?._items && controller._items.length) {
32
32
  const deviceType = controller._names && controller._names.tolower().indexOf('ssd') >= 0 ? 'SSD' : 'HD';
@@ -38,6 +38,10 @@ const parseDisplaysDarwin = (graphicsArr) => {
38
38
  currentResY: currentResolution.length > 1 ? parseInt(currentResolution[1], 10) : null,
39
39
  positionX: 0,
40
40
  positionY: 0,
41
+ workAreaResolutionX: null,
42
+ workAreaResolutionY: null,
43
+ workAreaPositionX: null,
44
+ workAreaPositionY: null,
41
45
  currentRefreshRate: currentResolutionParts.length > 1 ? parseInt(currentResolutionParts[1], 10) : null,
42
46
  scale: null
43
47
  });
@@ -86,6 +90,32 @@ const getDisplayPositionDarwin = async (displays) => {
86
90
  catch { }
87
91
  return displays;
88
92
  };
93
+ const jxaVisibleFrames = 'ObjC.import("AppKit"); var s = $.NSScreen.screens, out = []; for (var i = 0; i < s.count; i++) { var sc = s.objectAtIndex(i), f = sc.frame, v = sc.visibleFrame; out.push([sc.deviceDescription.objectForKey($("NSScreenNumber")).intValue, f.origin.x, f.origin.y, f.size.width, f.size.height, v.origin.x, v.origin.y, v.size.width, v.size.height].join("|")); } out.join("\\n")';
94
+ const getWorkAreaDarwin = async (displays) => {
95
+ try {
96
+ const { stdout } = await (0, exec_1.execSave)(`osascript -l JavaScript -e '${jxaVisibleFrames}'`);
97
+ const screens = stdout
98
+ .toString()
99
+ .split('\n')
100
+ .map((line) => line.split('|').map((part) => parseFloat(part)))
101
+ .filter((parts) => parts.length === 9 && !Number.isNaN(parts[0]));
102
+ const main = screens.find((parts) => parts[1] === 0 && parts[2] === 0);
103
+ if (!main) {
104
+ return displays;
105
+ }
106
+ screens.forEach((parts) => {
107
+ const display = displays.find((element) => (0, common_1.toInt)(element.displayId || '') === parts[0]);
108
+ if (display) {
109
+ display.workAreaResolutionX = Math.round(parts[7]);
110
+ display.workAreaResolutionY = Math.round(parts[8]);
111
+ display.workAreaPositionX = Math.round(parts[5]);
112
+ display.workAreaPositionY = Math.round(main[4] - (parts[6] + parts[8]));
113
+ }
114
+ });
115
+ }
116
+ catch { }
117
+ return displays;
118
+ };
89
119
  const displays = async () => {
90
120
  await (0, common_1.nextTick)();
91
121
  let result = [];
@@ -93,6 +123,7 @@ const displays = async () => {
93
123
  const { stdout } = await (0, exec_1.shareInflight)('SPDisplaysDataType', () => (0, exec_1.exec)('system_profiler -xml -detailLevel full SPDisplaysDataType'));
94
124
  result = parseDisplaysDarwin((0, darwin_1.plistParser)(stdout));
95
125
  result = await getDisplayPositionDarwin(result);
126
+ result = await getWorkAreaDarwin(result);
96
127
  }
97
128
  catch { }
98
129
  return result;
@@ -12,7 +12,7 @@ const parseControllersDarwin = (graphicsArr) => {
12
12
  const bus = (item.sppci_bus || '').indexOf('builtin') > -1 ? 'Built-In' : (item.sppci_bus || '').indexOf('pcie') > -1 ? 'PCIe' : '';
13
13
  const vram = (parseInt(item.spdisplays_vram || '', 10) || 0) * ((item.spdisplays_vram || '').indexOf('GB') > -1 ? 1024 : 1);
14
14
  const vramDyn = (parseInt(item.spdisplays_vram_shared || '', 10) || 0) * ((item.spdisplays_vram_shared || '').indexOf('GB') > -1 ? 1024 : 1);
15
- const metalVersion = (0, mappings_1.graphicsMetalVersion)(item.spdisplays_metal || item.spdisplays_metalfamily || '');
15
+ const metalVersion = (0, mappings_1.graphicsMetalVersion)(item.spdisplays_mtlgpufamilysupport || item.spdisplays_metal || item.spdisplays_metalfamily || '');
16
16
  controllers.push({
17
17
  vendor: (0, mappings_1.graphicsModelToVendor)(item.spdisplays_vendor || '') || item.spdisplays_vendor || '',
18
18
  model: item.sppci_model || '',
@@ -56,11 +56,11 @@ const filterBluetooth = (data) => {
56
56
  const keyboard = async () => {
57
57
  await (0, common_1.nextTick)();
58
58
  try {
59
- const { stdout } = await (0, exec_1.exec)('system_profiler SPSPIDataType SPUSBDataType SPBluetoothDataType -xml');
59
+ const { stdout } = await (0, exec_1.exec)('system_profiler SPSPIDataType SPUSBDataType SPUSBHostDataType SPBluetoothDataType -xml');
60
60
  const data = (0, darwin_1.plistParser)(stdout, false);
61
- const spiData = data.length >= 2 && data[0]._items ? data[0]._items : [];
62
- const usbData = data.length >= 2 && data[1]._items ? data[1]._items : [];
63
- const bluetoothData = data.length >= 3 && data[2]._items ? data[2]._items : [];
61
+ const spiData = (0, darwin_1.spItems)(data, 'SPSPIDataType');
62
+ const usbData = (0, darwin_1.spItems)(data, darwin_1.USB_DATA_TYPES);
63
+ const bluetoothData = (0, darwin_1.spItems)(data, 'SPBluetoothDataType');
64
64
  let result = parseKeyboard(spiData);
65
65
  result = result.concat(parseUsb(usbData));
66
66
  result = result.concat(filterBluetooth((0, bluetooth_1.parseBluetooth)(bluetoothData)));
@@ -61,11 +61,11 @@ const filterBluetooth = (data) => {
61
61
  const mouse = async () => {
62
62
  await (0, common_1.nextTick)();
63
63
  try {
64
- const { stdout } = await (0, exec_1.exec)('system_profiler SPSPIDataType SPUSBDataType SPBluetoothDataType -xml');
64
+ const { stdout } = await (0, exec_1.exec)('system_profiler SPSPIDataType SPUSBDataType SPUSBHostDataType SPBluetoothDataType -xml');
65
65
  const data = (0, darwin_1.plistParser)(stdout, false);
66
- const spiData = data.length >= 2 && data[0]._items ? data[0]._items : [];
67
- const usbData = data.length >= 2 && data[1]._items ? data[1]._items : [];
68
- const bluetoothData = data.length >= 3 && data[2]._items ? data[2]._items : [];
66
+ const spiData = (0, darwin_1.spItems)(data, 'SPSPIDataType');
67
+ const usbData = (0, darwin_1.spItems)(data, darwin_1.USB_DATA_TYPES);
68
+ const bluetoothData = (0, darwin_1.spItems)(data, 'SPBluetoothDataType');
69
69
  let result = parseKeyboard(spiData);
70
70
  result = result.concat(parseUsb(usbData));
71
71
  result = result.concat(filterBluetooth((0, bluetooth_1.parseBluetooth)(bluetoothData)));
@@ -140,6 +140,35 @@ const parseLinesLinuxDisplays = (lines, depth) => {
140
140
  });
141
141
  return displays;
142
142
  };
143
+ const getWorkAreaLinux = async (displays) => {
144
+ try {
145
+ const { stdout } = await (0, exec_1.execSave)('xprop -root _NET_WORKAREA 2>/dev/null');
146
+ const values = (stdout.toString().split('=')[1] || '').split(',').map((value) => (0, common_1.toInt)(value));
147
+ const [areaX, areaY, areaWidth, areaHeight] = values;
148
+ if (values.length < 4 || !areaWidth || !areaHeight) {
149
+ return displays;
150
+ }
151
+ displays.forEach((display) => {
152
+ const width = display.currentResX || display.resolutionX;
153
+ const height = display.currentResY || display.resolutionY;
154
+ if (!width || !height) {
155
+ return;
156
+ }
157
+ const left = Math.max(display.positionX, areaX);
158
+ const top = Math.max(display.positionY, areaY);
159
+ const right = Math.min(display.positionX + width, areaX + areaWidth);
160
+ const bottom = Math.min(display.positionY + height, areaY + areaHeight);
161
+ if (right > left && bottom > top) {
162
+ display.workAreaResolutionX = right - left;
163
+ display.workAreaResolutionY = bottom - top;
164
+ display.workAreaPositionX = left;
165
+ display.workAreaPositionY = top;
166
+ }
167
+ });
168
+ }
169
+ catch { }
170
+ return displays;
171
+ };
143
172
  const displays = async () => {
144
173
  await (0, common_1.nextTick)();
145
174
  const result = [];
@@ -171,6 +200,10 @@ const displays = async () => {
171
200
  currentResY: null,
172
201
  positionX: 0,
173
202
  positionY: 0,
203
+ workAreaResolutionX: null,
204
+ workAreaResolutionY: null,
205
+ workAreaPositionX: null,
206
+ workAreaPositionY: null,
174
207
  currentRefreshRate: null,
175
208
  scale: null
176
209
  });
@@ -186,7 +219,7 @@ const displays = async () => {
186
219
  try {
187
220
  ({ stdout } = await (0, exec_1.exec)('xrandr --verbose 2>/dev/null', const_1.execOptsLinux));
188
221
  const lines = stdout.toString().split('\n');
189
- return parseLinesLinuxDisplays(lines, depth);
222
+ return await getWorkAreaLinux(parseLinesLinuxDisplays(lines, depth));
190
223
  }
191
224
  catch { }
192
225
  }
@@ -28,6 +28,7 @@ const parseLinesWindowsDisplaysPowershell = (ssections, monitors, dsections, con
28
28
  const instanceName = monitor ? monitor.instanceName : '';
29
29
  const bitsPerPixel = (0, common_1.toInt)((0, common_1.getValue)(linesScreen, 'BitsPerPixel'));
30
30
  const bounds = (0, common_1.getValue)(linesScreen, 'Bounds').replace('{', '').replace('}', '').replace(/=/g, ':').split(',');
31
+ const workArea = (0, common_1.getValue)(linesScreen, 'WorkingArea').replace('{', '').replace('}', '').replace(/=/g, ':').split(',');
31
32
  const primary = (0, common_1.getValue)(linesScreen, 'Primary');
32
33
  const sizeX = monitor ? monitor.sizeX : '';
33
34
  const sizeY = monitor ? monitor.sizeY : '';
@@ -40,6 +41,11 @@ const parseLinesWindowsDisplaysPowershell = (ssections, monitors, dsections, con
40
41
  const boundsY = (0, common_1.toInt)((0, common_1.getValue)(bounds, 'Y', ':'));
41
42
  const resX = mode ? mode.width : boundsWidth;
42
43
  const resY = mode ? mode.height : boundsHeight;
44
+ const posX = mode ? mode.positionX : boundsX;
45
+ const posY = mode ? mode.positionY : boundsY;
46
+ const dpiScale = mode && boundsWidth ? mode.width / boundsWidth : 1;
47
+ const workAreaWidth = (0, common_1.getValue)(workArea, 'Width', ':');
48
+ const workAreaHeight = (0, common_1.getValue)(workArea, 'Height', ':');
43
49
  const isection = instanceName ? isections.find((element) => element.instanceId.toLowerCase().startsWith(instanceName)) : undefined;
44
50
  const dsection = instanceName ? desktopMonitors.find((element) => element.deviceId && instanceName.startsWith(element.deviceId)) : undefined;
45
51
  displays.push({
@@ -61,8 +67,12 @@ const parseLinesWindowsDisplaysPowershell = (ssections, monitors, dsections, con
61
67
  pixelDepth: bitsPerPixel,
62
68
  currentResX: resX,
63
69
  currentResY: resY,
64
- positionX: mode ? mode.positionX : boundsX,
65
- positionY: mode ? mode.positionY : boundsY,
70
+ positionX: posX,
71
+ positionY: posY,
72
+ workAreaResolutionX: workAreaWidth ? Math.round((0, common_1.toInt)(workAreaWidth) * dpiScale) : null,
73
+ workAreaResolutionY: workAreaHeight ? Math.round((0, common_1.toInt)(workAreaHeight) * dpiScale) : null,
74
+ workAreaPositionX: workAreaWidth ? Math.round(posX + ((0, common_1.toInt)((0, common_1.getValue)(workArea, 'X', ':')) - boundsX) * dpiScale) : null,
75
+ workAreaPositionY: workAreaHeight ? Math.round(posY + ((0, common_1.toInt)((0, common_1.getValue)(workArea, 'Y', ':')) - boundsY) * dpiScale) : null,
66
76
  currentRefreshRate: (mode && mode.refreshRate) || null,
67
77
  scale: mode && boundsWidth ? Math.round((mode.width / boundsWidth) * 100) / 100 : null
68
78
  });
@@ -91,6 +101,10 @@ const parseLinesWindowsDisplaysPowershell = (ssections, monitors, dsections, con
91
101
  currentResY: first ? first.resolutionY : 0,
92
102
  positionX: 0,
93
103
  positionY: 0,
104
+ workAreaResolutionX: null,
105
+ workAreaResolutionY: null,
106
+ workAreaPositionX: null,
107
+ workAreaPositionY: null,
94
108
  currentRefreshRate: null,
95
109
  scale: null
96
110
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "6.0.0-beta.10",
3
+ "version": "6.0.0-beta.11",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",