1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-23 19:53:47 +00:00

1. Added ability to allow importing lib locations for X via env vars

2. Updated notifybar-desktop for X to import X lib location when spawning child
This commit is contained in:
Bryan Roe
2019-10-07 17:04:12 -07:00
parent 9ad6891d3a
commit 92da4d02b3
3 changed files with 30 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@@ -221,6 +221,11 @@ function monitorinfo()
}
} catch (ex) { }
}
if (process.env['Location_X11LIB']) { Object.defineProperty(this, 'Location_X11LIB', { value: process.env['Location_X11LIB'] }); }
if (process.env['Location_X11TST']) { Object.defineProperty(this, 'Location_X11TST', { value: process.env['Location_X11TST'] }); }
if (process.env['Location_X11EXT']) { Object.defineProperty(this, 'Location_X11EXT', { value: process.env['Location_X11EXT'] }); }
if (process.env['Location_X11FIXES']) { Object.defineProperty(this, 'Location_X11FIXES', { value: process.env['Location_X11FIXES'] }); }
}
}
if(process.platform == 'freebsd')
@@ -434,7 +439,7 @@ function monitorinfo()
var tokens = child.stdout.str.trim().split(',');
if (tokens.length == 3)
{
ret = { tty: tokens[1], xauthority: tokens[2] };
ret = { tty: tokens[1], xauthority: tokens[2], exportEnv: exportEnv };
}
if (ret == null)
@@ -456,7 +461,7 @@ function monitorinfo()
var e = require('user-sessions').getEnvFromPid(ln);
if(e.XAUTHORITY && e.DISPLAY)
{
ret = { tty: '?', xauthority: e.XAUTHORITY, display: e.DISPLAY };
ret = { tty: '?', xauthority: e.XAUTHORITY, display: e.DISPLAY, exportEnv: exportEnv };
return (ret);
}
}
@@ -472,7 +477,7 @@ function monitorinfo()
var e = require('user-sessions').getEnvFromPid(ln);
if (e.DISPLAY)
{
ret = { tty: '?', display: e.DISPLAY };
ret = { tty: '?', display: e.DISPLAY, exportEnv: exportEnv };
return (ret);
}
}
@@ -524,6 +529,19 @@ function monitorinfo()
}
}
function exportEnv()
{
var r =
{
XAUTHORITY: this.xauthority, DISPLAY: this.display,
Location_X11LIB: require('monitor-info').Location_X11LIB,
Location_X11TST: require('monitor-info').Location_X11TST,
Location_X11EXT: require('monitor-info').Location_X11EXT,
Location_X11FIXES: require('monitor-info').Location_X11FIXES
};
return (r);
}
if (process.platform != 'darwin')
{
module.exports = new monitorinfo();

View File

@@ -164,7 +164,7 @@ function x_notifybar_check(title)
.createEvent('close')
.addMethod('close', function close() { this.child.kill(); });
ret.child = require('child_process').execFile(process.execPath, [process.execPath.split('/').pop(), '-b64exec', script], { uid: uid, env: { XAUTHORITY: xinfo.xauthority, DISPLAY: xinfo.display } });
ret.child = require('child_process').execFile(process.execPath, [process.execPath.split('/').pop(), '-b64exec', script], { uid: uid, env: xinfo.exportEnv() });
ret.child.parent = ret;
ret.child.stdout.on('data', function (c) { });
ret.child.stderr.on('data', function (c) { });
@@ -214,6 +214,7 @@ function x_notifybar(title)
require('monitor-info').setAllowedActions(m[i].display, this.notifybar._windows.peek().notifybar, require('monitor-info').MOTIF_FLAGS.MWM_FUNC_CLOSE);
require('monitor-info').setAlwaysOnTop(m[i].display, this.notifybar._windows.peek().root, this.notifybar._windows.peek().notifybar);
var wm_delete_window_atom = require('monitor-info')._X11.XInternAtom(m[i].display, require('_GenericMarshal').CreateVariable('WM_DELETE_WINDOW'), 0).Val;
var atoms = require('_GenericMarshal').CreateVariable(4);
atoms.toBuffer().writeUInt32LE(wm_delete_window_atom);