Skip to content

Commit 1377336

Browse files
committed
fix compilation by patching dbus-next
1 parent 8c248c1 commit 1377336

File tree

3 files changed

+85
-1
lines changed

3 files changed

+85
-1
lines changed

bun.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
},
5353
"patchedDependencies": {
5454
"@jellybrick/mpris-service@2.1.5": "patches/@jellybrick%2Fmpris-service@2.1.5.patch",
55+
"@jellybrick/dbus-next@0.10.3": "patches/@jellybrick%2Fdbus-next@0.10.3.patch",
5556
"yoga-wasm-web@0.3.3": "patches/yoga-wasm-web@0.3.3.patch",
5657
},
5758
"packages": {

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
},
6161
"patchedDependencies": {
6262
"yoga-wasm-web@0.3.3": "patches/yoga-wasm-web@0.3.3.patch",
63-
"@jellybrick/mpris-service@2.1.5": "patches/@jellybrick%2Fmpris-service@2.1.5.patch"
63+
"@jellybrick/mpris-service@2.1.5": "patches/@jellybrick%2Fmpris-service@2.1.5.patch",
64+
"@jellybrick/dbus-next@0.10.3": "patches/@jellybrick%2Fdbus-next@0.10.3.patch"
6465
}
6566
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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

Comments
 (0)