From 0ccc0abc3833fbd464f5a4be8f8b4672cca9b21d Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Fri, 18 Oct 2019 16:57:18 +0200 Subject: [PATCH] graphics() fallback display detection (windows) --- CHANGELOG.md | 1 + docs/history.html | 5 +++++ docs/index.html | 2 +- lib/graphics.js | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2ecc1e..9ea7598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ For major (breaking) changes - version 3 and 2 see end of page. | Version | Date | Comment | | -------------- | -------------- | -------- | +| 4.14.15 | 2019-10-18 | `graphics()` fallback display detection (windows) | | 4.14.14 | 2019-10-18 | `powerShell()` fixed error handling (windows) | | 4.14.13 | 2019-10-15 | `networkConnections()` fixed parsing (linux) | | 4.14.12 | 2019-10-14 | `getCpu()` fixed multi socket detection (linux) | diff --git a/docs/history.html b/docs/history.html index c282dcf..fa616ff 100644 --- a/docs/history.html +++ b/docs/history.html @@ -83,6 +83,11 @@ + + 4.14.15 + 2019-10-18 + graphics() fallback display detection (windows) + 4.14.14 2019-10-18 diff --git a/docs/index.html b/docs/index.html index 77b8285..a7b26a5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -168,7 +168,7 @@
systeminformation
-
Current Version: 4.14.14
+
Current Version: 4.14.15
diff --git a/lib/graphics.js b/lib/graphics.js index dfc3f6f..9807fbc 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -687,6 +687,8 @@ function graphics(callback) { vendor = util.getValue(linesDisplay, 'MonitorManufacturer', '='); model = util.getValue(linesDisplay, 'Name', '='); deviceID = util.getValue(linesDisplay, 'PNPDeviceID', '=').replace(/&/g, '&').toLowerCase(); + resolutionx = parseInt((util.getValue(linesDisplay, 'ScreenWidth', '=') || '0'), 10); + resolutionx = parseInt((util.getValue(linesDisplay, 'ScreenHeight', '=') || '0'), 10); } for (let i = 0; i < ssections.length; i++) { @@ -722,6 +724,22 @@ function graphics(callback) { }); } } + if (ssections.length === 0) { + displays.push({ + vendor, + model, + main: true, + resolutionx, + resolutiony, + sizex: -1, + sizey: -1, + pixeldepth: -1, + currentResX: resolutionx, + currentResY: resolutiony, + positionX: 0, + positionY: 0 + }); + } return displays; }