File sysconfig-support.patch of Package sddm

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 43796954d519fda27133dbaed6db50141b8ecf04..3071ea79ebaf9e5c20851f2c2512339f0f06f25c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -156,6 +156,7 @@ set(SESSION_COMMAND             "${DATA_INSTALL_DIR}/scripts/Xsession"
 set(WAYLAND_SESSION_COMMAND     "${DATA_INSTALL_DIR}/scripts/wayland-session"       CACHE PATH      "Script to execute when starting the Wayland desktop session")
 
 set(CONFIG_FILE                 "${CMAKE_INSTALL_FULL_SYSCONFDIR}/sddm.conf"        CACHE PATH      "Path of the sddm config file")
+set(DYSPLAY_MANAGER_CONFIG_FILE "${CMAKE_INSTALL_FULL_SYSCONFDIR}/sysconfig/displaymanager"        CACHE PATH      "Path of the sysconfig/displaymanager config file")
 set(LOG_FILE                    "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/log/sddm.log"  CACHE PATH      "Path of the sddm log file")
 set(DBUS_CONFIG_FILENAME        "org.freedesktop.DisplayManager.conf"               CACHE STRING    "Name of the sddm config file")
 set(COMPONENTS_TRANSLATION_DIR  "${DATA_INSTALL_DIR}/translations"                  CACHE PATH      "Components translations directory")
diff --git a/src/common/Configuration.h b/src/common/Configuration.h
index c9af1b72cd0faee069264719ff26cc7d7cba204c..076e856e5ca592bf1b3dcd48a6511fc2395159a8 100644
--- a/src/common/Configuration.h
+++ b/src/common/Configuration.h
@@ -83,7 +83,7 @@ namespace SDDM {
         );
         Section(Autologin,
             Entry(User,                QString,     QString(),                                  _S("Autologin user"));
-            Entry(Session,             QString,     QString(),                                  _S("Autologin session"));
+            Entry(Session,             QString,     _S("plasma5.desktop"),                      _S("Autologin session"));
             Entry(Relogin,             bool,        false,                                      _S("Autologin again on session exit"));
         );
     );
diff --git a/src/common/Constants.h.in b/src/common/Constants.h.in
index 2be895e730da5affb2cd4f6052918a8ab4b2672a..bb935503c08e8ad617f83f9df73d5c7703737686 100644
--- a/src/common/Constants.h.in
+++ b/src/common/Constants.h.in
@@ -33,6 +33,7 @@
 #define WAYLAND_SESSION_COMMAND     "@WAYLAND_SESSION_COMMAND@"
 
 #define CONFIG_FILE                 "@CONFIG_FILE@"
+#define DYSPLAY_MANAGER_CONFIG_FILE "@DYSPLAY_MANAGER_CONFIG_FILE@"
 #define LOG_FILE                    "@LOG_FILE@"
 #define PID_FILE                    "@PID_FILE@"
 #define MINIMUM_VT                  @MINIMUM_VT@
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
index 2b76c6dbe64b3d35a0e6b1849cf10c250ead5f53..0d62358dc515826d18d9eb825a83149cf268ee9d 100644
--- a/src/daemon/Display.cpp
+++ b/src/daemon/Display.cpp
@@ -35,6 +35,7 @@
 #include <QDebug>
 #include <QFile>
 #include <QTimer>
+#include <QSettings>
 
 #include <pwd.h>
 #include <unistd.h>
@@ -114,8 +115,19 @@ namespace SDDM {
         // log message
         qDebug() << "Display server started.";
 
+        QSettings sysconfSettings(QStringLiteral(DYSPLAY_MANAGER_CONFIG_FILE), QSettings::NativeFormat);
+        QString sysconfigUser = sysconfSettings.value(QStringLiteral("DISPLAYMANAGER_AUTOLOGIN"), QStringLiteral("")).toString();
+
+        if (!sysconfigUser.isEmpty()) {
+            mainConfig.Autologin.User.set(sysconfigUser);
+            mainConfig.save();
+        } else  {
+            mainConfig.Autologin.User.set(QString());
+            mainConfig.save();
+        }
+
         if ((daemonApp->first || mainConfig.Autologin.Relogin.get()) &&
-            !mainConfig.Autologin.User.get().isEmpty() && !mainConfig.Autologin.Session.get().isEmpty()) {
+            !mainConfig.Autologin.User.get().isEmpty()) {
             // reset first flag
             daemonApp->first = false;
 
openSUSE Build Service is sponsored by