From 54b9972e5367e4277bbb8408032f3f7c29d3389c Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 23 Apr 2024 17:26:45 +0100 Subject: [PATCH] loginManager: Allow access to the D-Bus user proxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s needed in an upcoming commit, to watch the user’s state (active/online/offline/lingering/closing). Signed-off-by: Philip Withnall --- js/misc/loginManager.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js index 1515fc9e3..4a7859e46 100644 --- a/js/misc/loginManager.js +++ b/js/misc/loginManager.js @@ -106,6 +106,10 @@ class LoginManagerSystemd extends Signals.EventEmitter { this._sessionRemoved.bind(this)); } + getCurrentUserProxy() { + return this._userProxy; + } + async getCurrentSessionProxy() { if (this._currentSession) return this._currentSession; @@ -220,6 +224,12 @@ class LoginManagerSystemd extends Signals.EventEmitter { } class LoginManagerDummy extends Signals.EventEmitter { + getCurrentUserProxy() { + // we could return a DummyUser object that fakes whatever callers + // expect, but just never settling the promise should be safer + return new Promise(() => {}); + } + getCurrentSessionProxy() { // we could return a DummySession object that fakes whatever callers // expect (at the time of writing: connect() and connectSignal()