-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbustest.js
33 lines (28 loc) · 908 Bytes
/
dbustest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
function callback(connection, senderName, objectPath, interfaceName, signalName, parameters, userData) {
// log("connection: " + connection);
// log("senderName: " + senderName);
// log("objectPath: " + objectPath);
// log("interfaceName: " + interfaceName);
// log("signalName: " + signalName);
// log("parameters: " + parameters);
// log("userData: " + userData);
let unpacked = parameters.get_child_value(0).get_boolean();
if (unpacked) {
log("unpacked value: " + unpacked);
log("unpacked type: " + typeof unpacked);
}
}
let id = Gio.DBus.session.signal_subscribe(
null,
"org.gnome.ScreenSaver",
"ActiveChanged",
"/org/gnome/ScreenSaver",
null,
0,
callback
);
// Gio.DBus.session.signal_unsubscribe(id);
let loop = new GLib.MainLoop(null, false);
loop.run();