bugfix graphics info

This commit is contained in:
Sebastian Hildebrandt 2016-09-14 09:52:29 +02:00
parent 9ae9e752f4
commit c1ec48337f
2 changed files with 21 additions and 16 deletions

View File

@ -394,6 +394,7 @@ I am happy to discuss any comments and suggestions. Please feel free to contact
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 3.5.1 | 2016-09-14 | bugfix graphics info |
| 3.5.0 | 2016-09-14 | added graphics info (controller, display) |
| 3.4.4 | 2016-09-02 | tiny fixes system.model, getDefaultNetworkInterface |
| 3.4.3 | 2016-09-02 | tiny bug fix fsStats, disksIO OSX |

View File

@ -81,6 +81,7 @@
// --------------------------------
//
// version date comment
// 3.5.1 2016-09-14 bugfix graphics info
// 3.5.0 2016-09-14 added graphics info (controller, display)
// 3.4.4 2016-09-02 tiny fixes system.model, getDefaultNetworkInterface
// 3.4.3 2016-09-02 tiny bug fix fsStats, disksIO OSX
@ -1149,7 +1150,10 @@ function graphics(callback) {
}
reject(error);
}
let result = {};
let result = {
controllers: [],
displays: []
};
if (_darwin) {
let cmd = 'system_profiler SPDisplaysDataType';
exec(cmd, function (error, stdout) {
@ -1169,26 +1173,26 @@ function graphics(callback) {
if (!error) {
let lines = stdout.toString().split('\n');
result.controllers = parseLinesLinuxControllers(lines);
let cmd = "xdpyinfo 2>/dev/null | grep 'depth of root window' | awk '{ print $5 }'";
}
let cmd = "xdpyinfo 2>/dev/null | grep 'depth of root window' | awk '{ print $5 }'";
exec(cmd, function (error, stdout) {
let depth = 0;
if (!error) {
let lines = stdout.toString().split('\n');
depth = parseInt(lines[0]) || 0;
}
let cmd = 'xrandr --verbose 2>/dev/null';
exec(cmd, function (error, stdout) {
let depth = 0;
if (!error) {
let lines = stdout.toString().split('\n');
depth = parseInt(lines[0]) || 0;
result.displays = parseLinesLinuxDisplays(lines, depth);
}
let cmd = 'xrandr --verbose 2>/dev/null';
exec(cmd, function (error, stdout) {
if (!error) {
let lines = stdout.toString().split('\n');
result.displays = parseLinesLinuxDisplays(lines, depth);
}
if (callback) {
callback(result)
}
resolve(result);
})
if (callback) {
callback(result)
}
resolve(result);
})
}
})
})
}
});