From a37d6d480b344cd69e596dd67a6a084f7b4cef66 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 Part-of: --- js/misc/loginManager.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js index 3c4d6f5a8..465148492 100644 --- a/js/misc/loginManager.js +++ b/js/misc/loginManager.js @@ -104,6 +104,10 @@ class LoginManagerSystemd extends Signals.EventEmitter { this._sessionRemoved.bind(this)); } + getCurrentUserProxy() { + return this._userProxy; + } + async getCurrentSessionProxy() { if (this._currentSession) return this._currentSession; @@ -218,6 +222,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()