Start DBus proxy asynchronously

This commit is contained in:
Rafał Dzięgiel
2021-02-16 15:07:17 +01:00
parent 2347ff52bf
commit 435264cbec

View File

@@ -15,12 +15,31 @@ const ShellProxyWrapper = Gio.DBusProxy.makeProxyWrapper(`
</node>` </node>`
); );
let shellProxy = new ShellProxyWrapper( let shellProxy = null;
Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell'
new ShellProxyWrapper(
Gio.DBus.session,
'org.gnome.Shell',
'/org/gnome/Shell',
(proxy, err) => {
if(err) {
debug(err);
return;
}
shellProxy = proxy;
debug('GNOME Shell DBus proxy is ready');
},
null,
Gio.DBusProxyFlags.DO_NOT_AUTO_START_AT_CONSTRUCTION
| Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS
); );
function shellWindowEval(fn, isEnabled) function shellWindowEval(fn, isEnabled)
{ {
if(!shellProxy)
return;
const un = (isEnabled) ? '' : 'un'; const un = (isEnabled) ? '' : 'un';
debug(`changing ${fn}`); debug(`changing ${fn}`);