Blob Blame History Raw
From 77b52a04c9154a7e7b2434f6c70ba6b4fd84c9f1 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 15 Oct 2020 15:18:35 +0200
Subject: [PATCH] power: Avoid automatic logout in GDM/greeter

In GDM sessions (greeter, initial-setup), it does not make sense to
automatically logout. This can happen if the system wide default is
changed to default to the "logout" action.

Note that we already use the RUNNING_UNDER_GDM environment variable in
the keyboard plugin currently. So doing this is likely sane, even if we
probably want a more elegant strategy to detect whether we are in a
"login" session.
---
 plugins/power/gsd-power-manager.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index e103a8a7..b100ff9e 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -872,6 +872,9 @@ static void
 gnome_session_logout (GsdPowerManager *manager,
                       guint            logout_mode)
 {
+        if (g_getenv("RUNNING_UNDER_GDM"))
+                return;
+
         g_dbus_proxy_call (G_DBUS_PROXY (manager->priv->session),
                            "Logout",
                            g_variant_new ("(u)", logout_mode),
-- 
2.26.2