From 435264cbeca6232171c7555c32469d1be1d78fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Tue, 16 Feb 2021 15:07:17 +0100 Subject: [PATCH] Start DBus proxy asynchronously --- src/dbus.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/dbus.js b/src/dbus.js index 55a5cbf9..b2c6bb1f 100644 --- a/src/dbus.js +++ b/src/dbus.js @@ -15,12 +15,31 @@ const ShellProxyWrapper = Gio.DBusProxy.makeProxyWrapper(` ` ); -let shellProxy = new ShellProxyWrapper( - Gio.DBus.session, 'org.gnome.Shell', '/org/gnome/Shell' +let shellProxy = null; + +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) { + if(!shellProxy) + return; + const un = (isEnabled) ? '' : 'un'; debug(`changing ${fn}`);