|
| 1 | +diff --git a/lib/address-x11.js b/lib/address-x11.js |
| 2 | +index c4fbfa38cd25c940983fc5e2ef0b4a5a36f5ac61..64f9991decda854851036bf73145d3918e24e82d 100644 |
| 3 | +--- a/lib/address-x11.js |
| 4 | ++++ b/lib/address-x11.js |
| 5 | +@@ -4,40 +4,44 @@ const os = require('os'); |
| 6 | + function getDbusAddressFromWindowSelection (callback) { |
| 7 | + // read dbus adress from window selection |
| 8 | + // TODO: implement this somewhere |
| 9 | +- const x11 = require('x11'); |
| 10 | +- if (x11 === null) { |
| 11 | +- throw new Error('cannot get session bus address from window selection: dbus-next was installed without x11 support'); |
| 12 | +- } |
| 13 | ++ // |
| 14 | ++ // ! this is commected out as a patch, |
| 15 | ++ // as it breaks compilation, even though it is not used anywhere |
| 16 | ++ |
| 17 | ++ // const x11 = require('x11'); |
| 18 | ++ // if (x11 === null) { |
| 19 | ++ // throw new Error('cannot get session bus address from window selection: dbus-next was installed without x11 support'); |
| 20 | ++ // } |
| 21 | + |
| 22 | +- // read machine uuid |
| 23 | +- fs.readFile('/var/lib/dbus/machine-id', 'ascii', function (err, uuid) { |
| 24 | +- if (err) return callback(err); |
| 25 | +- const hostname = os.hostname().split('-')[0]; |
| 26 | +- x11.createClient(function (err, display) { |
| 27 | +- if (err) return callback(err); |
| 28 | +- const X = display.client; |
| 29 | +- const selectionName = `_DBUS_SESSION_BUS_SELECTION_${ |
| 30 | +- hostname |
| 31 | +- }_${uuid.trim()}`; |
| 32 | +- X.InternAtom(false, selectionName, function (err, id) { |
| 33 | +- if (err) return callback(err); |
| 34 | +- X.GetSelectionOwner(id, function (err, win) { |
| 35 | +- if (err) return callback(err); |
| 36 | +- X.InternAtom(false, '_DBUS_SESSION_BUS_ADDRESS', function ( |
| 37 | +- err, |
| 38 | +- propId |
| 39 | +- ) { |
| 40 | +- if (err) return callback(err); |
| 41 | +- win = display.screen[0].root; |
| 42 | +- X.GetProperty(0, win, propId, 0, 0, 10000000, function (err, val) { |
| 43 | +- if (err) return callback(err); |
| 44 | +- callback(null, val.data.toString()); |
| 45 | +- }); |
| 46 | +- }); |
| 47 | +- }); |
| 48 | +- }); |
| 49 | +- }); |
| 50 | +- }); |
| 51 | ++ // // read machine uuid |
| 52 | ++ // fs.readFile('/var/lib/dbus/machine-id', 'ascii', function (err, uuid) { |
| 53 | ++ // if (err) return callback(err); |
| 54 | ++ // const hostname = os.hostname().split('-')[0]; |
| 55 | ++ // x11.createClient(function (err, display) { |
| 56 | ++ // if (err) return callback(err); |
| 57 | ++ // const X = display.client; |
| 58 | ++ // const selectionName = `_DBUS_SESSION_BUS_SELECTION_${ |
| 59 | ++ // hostname |
| 60 | ++ // }_${uuid.trim()}`; |
| 61 | ++ // X.InternAtom(false, selectionName, function (err, id) { |
| 62 | ++ // if (err) return callback(err); |
| 63 | ++ // X.GetSelectionOwner(id, function (err, win) { |
| 64 | ++ // if (err) return callback(err); |
| 65 | ++ // X.InternAtom(false, '_DBUS_SESSION_BUS_ADDRESS', function ( |
| 66 | ++ // err, |
| 67 | ++ // propId |
| 68 | ++ // ) { |
| 69 | ++ // if (err) return callback(err); |
| 70 | ++ // win = display.screen[0].root; |
| 71 | ++ // X.GetProperty(0, win, propId, 0, 0, 10000000, function (err, val) { |
| 72 | ++ // if (err) return callback(err); |
| 73 | ++ // callback(null, val.data.toString()); |
| 74 | ++ // }); |
| 75 | ++ // }); |
| 76 | ++ // }); |
| 77 | ++ // }); |
| 78 | ++ // }); |
| 79 | ++ // }); |
| 80 | + } |
| 81 | + |
| 82 | + function getDbusAddressFromFs () { |
0 commit comments