From a4609a92fb03c33d9c2d5567171e882780145091 Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Sat, 19 Oct 2019 17:50:48 +0200 Subject: [PATCH] graphics() improving display detection (windows) --- lib/graphics.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/graphics.js b/lib/graphics.js index 0b62046..a2e0ffa 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -698,15 +698,16 @@ function graphics(callback) { let vendor = ''; let model = ''; let deviceID = ''; + let resolutionx = 0; + let resolutiony = 0; if (dsections && dsections.length) { let linesDisplay = dsections[0].split(os.EOL); 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); + resolutionx = util.toInt(util.getValue(linesDisplay, 'ScreenWidth', '=')); + resolutiony = util.toInt(util.getValue(linesDisplay, 'ScreenHeight', '=')); } - for (let i = 0; i < ssections.length; i++) { if (ssections[i].trim() !== '') { ssections[i] = 'BitsPerPixel ' + ssections[i];