From 74e6b9c1b2729a0451193154404ef6459c797b69 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Fri, 22 Mar 2019 19:53:44 -0400 Subject: [PATCH] Install systeminformation module. This will allow a cross platform solution that doesnt use the electron api for enumerating displays --- app/lib/system/index.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/app/lib/system/index.js b/app/lib/system/index.js index d225ec7..af528c0 100644 --- a/app/lib/system/index.js +++ b/app/lib/system/index.js @@ -2,11 +2,8 @@ const os = require('os'); const electron = require('electron'); - +//private const exec = require('exec'); -//const spawn = require('spawn'); -//const exit = require('exit'); - /** * Evaluates system dependencies for digital * projector features by executing processes with @@ -39,6 +36,19 @@ async function dependencies (platform) { return obj; } +function getDisplays () { + let displays = electron.screen.getAllDisplays(); + return displays.map(obj => { + return { + width : obj.workArea.width, + height : obj.workArea.height, + x : obj.bounds.x, + y : obj.bounds.y + } + }); + +} + /** * Profile the current system and return an object with * data about the displays and dependencies for the digital @@ -48,7 +58,6 @@ async function dependencies (platform) { */ async function system () { const obj = {}; - let displays = electron.screen.getAllDisplays(); let platform; try { @@ -67,15 +76,7 @@ async function system () { obj.platform = 'nix'; } - obj.displays = displays.map(obj => { - return { - width : obj.workArea.width, - height : obj.workArea.height, - x : obj.bounds.x, - y : obj.bounds.y - } - }); - + obj.displays = getDisplays() obj.deps = await dependencies(obj.platform); return obj;