FIX#107: Indicator stops working after screen lock
Diego Rivera authored 5 years ago
Marco Trevisan committed 4 years ago
46 | 46 |
// monitor the bus manually to find out when the name vanished so we can reclaim it again.
|
47 | 47 |
function maybe_enable_after_name_available() {
|
48 | 48 |
// by the time we get called whe might not be enabled
|
49 | |
if (isEnabled && !watchDog.isPresent && statusNotifierWatcher === null)
|
50 | |
statusNotifierWatcher = new StatusNotifierWatcher.StatusNotifierWatcher();
|
|
49 |
if (isEnabled && (!watchDog.nameAcquired || !watchDog.isPresent) && statusNotifierWatcher === null)
|
|
50 |
statusNotifierWatcher = new StatusNotifierWatcher.StatusNotifierWatcher(watchDog);
|
51 | 51 |
}
|
52 | 52 |
|
53 | 53 |
function enable() {
|
|
74 | 74 |
|
75 | 75 |
// will be set in the handlers which are guaranteed to be called at least once
|
76 | 76 |
this.isPresent = false;
|
|
77 |
// Assume the name was acquired...we'll be told otherwise if necessary
|
|
78 |
this.nameAcquired = true;
|
77 | 79 |
|
78 | 80 |
this._watcher_id = Gio.DBus.session.watch_name("org.kde.StatusNotifierWatcher", 0,
|
79 | 81 |
this._appeared_handler.bind(this), this._vanished_handler.bind(this));
|
|
82 |
}
|
|
83 |
|
|
84 |
setNameAcquired(acquired) {
|
|
85 |
this.nameAcquired = acquired;
|
80 | 86 |
}
|
81 | 87 |
|
82 | 88 |
destroy() {
|
43 | 43 |
*/
|
44 | 44 |
var StatusNotifierWatcher = class AppIndicators_StatusNotifierWatcher {
|
45 | 45 |
|
46 | |
constructor() {
|
|
46 |
constructor(watchDog) {
|
|
47 |
this.watchDog = watchDog;
|
47 | 48 |
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(Interfaces.StatusNotifierWatcher, this);
|
48 | 49 |
this._dbusImpl.export(Gio.DBus.session, WATCHER_OBJECT);
|
49 | 50 |
this._cancellable = new Gio.Cancellable;
|
|
60 | 61 |
|
61 | 62 |
_acquiredName() {
|
62 | 63 |
this._everAcquiredName = true;
|
|
64 |
if (this.watchDog !== null) this.watchDog.setNameAcquired(true);
|
63 | 65 |
}
|
64 | 66 |
|
65 | 67 |
_lostName() {
|
|
67 | 69 |
Util.Logger.debug('Lost name' + WATCHER_BUS_NAME);
|
68 | 70 |
else
|
69 | 71 |
Util.Logger.warn('Failed to acquire ' + WATCHER_BUS_NAME);
|
|
72 |
if (this.watchDog !== null) this.watchDog.setNameAcquired(false);
|
70 | 73 |
}
|
71 | 74 |
|
72 | 75 |
|