1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 07:43:50 +00:00

Fixed error case for linux notifications, by checking zenity version, to do fallback for notify-send, if it exists, otherwise using zenity --info, with a faked timeout if necessary.

This commit is contained in:
Bryan Roe
2019-08-22 00:36:15 -07:00
parent 0469531f02
commit a0ffbc1e90
3 changed files with 58 additions and 60 deletions

View File

@@ -171,6 +171,20 @@ function linux_messageBox()
})()
});
}
else
{
Object.defineProperty(this, 'notifysend',
{
value: (function ()
{
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.on('data', function (chunk) { this.str += chunk.toString(); });
child.stdin.write("whereis notify-send | awk '{ print $2 }'\nexit\n");
child.waitExit();
return (child.stdout.str.trim() == '' ? null : { path: child.stdout.str.trim() });
})()
});
}
this.create = function create(title, caption, timeout)
{