[gnome-shell/wip/laney/systemd-user: 2/2] endSessionDialog: Get session from logind as fallback



commit be43b34dba6cc75ffa79fa25d04a609f888b0992
Author: Iain Lane <iain orangesquash org uk>
Date:   Mon Jan 8 14:57:07 2018 +0000

    endSessionDialog: Get session from logind as fallback
    
    When trying to hide the current session, we need to know the current
    session ID. Get this from logind in case XDG_SESSION_ID isn't set -
    as will happen if we're launched from systemd.

 js/misc/loginManager.js   |    4 ++++
 js/ui/endSessionDialog.js |   10 +++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/js/misc/loginManager.js b/js/misc/loginManager.js
index 6caef2b..43d50d2 100644
--- a/js/misc/loginManager.js
+++ b/js/misc/loginManager.js
@@ -155,6 +155,10 @@ var LoginManagerSystemd = new Lang.Class({
             }));
     },
 
+    getCurrentSession: function() {
+        return this._currentSession;
+    },
+
     canSuspend: function(asyncCallback) {
         this._proxy.CanSuspendRemote(function(result, error) {
             if (error) {
diff --git a/js/ui/endSessionDialog.js b/js/ui/endSessionDialog.js
index 25e59dc..d96ec4c 100644
--- a/js/ui/endSessionDialog.js
+++ b/js/ui/endSessionDialog.js
@@ -701,7 +701,15 @@ var EndSessionDialog = new Lang.Class({
                 if (proxy.State == 'closing')
                     continue;
 
-                if (proxy.Id == GLib.getenv('XDG_SESSION_ID'))
+                let sessionId = GLib.getenv('XDG_SESSION_ID');
+                if (!sessionId) {
+                        let currentSession = this._loginManager.getCurrentSession();
+                        if (currentSession) {
+                                sessionId = currentSession.Id;
+                        }
+                }
+
+                if (proxy.Id == sessionId)
                     continue;
 
                 let session = { user: this._userManager.get_user(userName),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]