Install systeminformation module. This will allow a cross platform solution that doesnt use the electron api for enumerating displays
This commit is contained in:
parent
1413e323f0
commit
74e6b9c1b2
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
|
//private
|
||||||
const exec = require('exec');
|
const exec = require('exec');
|
||||||
//const spawn = require('spawn');
|
|
||||||
//const exit = require('exit');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates system dependencies for digital
|
* Evaluates system dependencies for digital
|
||||||
* projector features by executing processes with
|
* projector features by executing processes with
|
||||||
|
@ -39,6 +36,19 @@ async function dependencies (platform) {
|
||||||
return obj;
|
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
|
* Profile the current system and return an object with
|
||||||
* data about the displays and dependencies for the digital
|
* data about the displays and dependencies for the digital
|
||||||
|
@ -48,7 +58,6 @@ async function dependencies (platform) {
|
||||||
*/
|
*/
|
||||||
async function system () {
|
async function system () {
|
||||||
const obj = {};
|
const obj = {};
|
||||||
let displays = electron.screen.getAllDisplays();
|
|
||||||
let platform;
|
let platform;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -67,15 +76,7 @@ async function system () {
|
||||||
obj.platform = 'nix';
|
obj.platform = 'nix';
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.displays = displays.map(obj => {
|
obj.displays = getDisplays()
|
||||||
return {
|
|
||||||
width : obj.workArea.width,
|
|
||||||
height : obj.workArea.height,
|
|
||||||
x : obj.bounds.x,
|
|
||||||
y : obj.bounds.y
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
obj.deps = await dependencies(obj.platform);
|
obj.deps = await dependencies(obj.platform);
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
Loading…
Reference in New Issue