File sysconfig-support.patch of Package sddm

Index: sddm-0.14.0/CMakeLists.txt
===================================================================
--- sddm-0.14.0.orig/CMakeLists.txt
+++ sddm-0.14.0/CMakeLists.txt
@@ -160,6 +160,7 @@ set(SESSION_COMMAND             "${DATA_
 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(DISPLAY_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")
Index: sddm-0.14.0/src/common/Configuration.h
===================================================================
--- sddm-0.14.0.orig/src/common/Configuration.h
+++ sddm-0.14.0/src/common/Configuration.h
@@ -90,14 +90,14 @@ namespace SDDM {
 
         Section(Autologin,
             Entry(User,                QString,     QString(),                                  _S("Username for autologin session"));
-            Entry(Session,             QString,     QString(),                                  _S("Name of session file for autologin session"));
+            Entry(Session,             QString,     _S("default.desktop"),                      _S("Name of session file for autologin session"));
             Entry(Relogin,             bool,        false,                                      _S("Whether sddm should automatically log back into sessions when they exit"));
         );
     );
 
     Config(StateConfig, []()->QString{auto tmp = getpwnam("sddm"); return tmp ? QString::fromLocal8Bit(tmp->pw_dir) : QStringLiteral(STATE_DIR);}().append(QStringLiteral("/state.conf")),
         Section(Last,
-            Entry(Session,         QString,     QString(),                                      _S("Name of the session for the last logged-in user.\n"
+            Entry(Session,         QString,     _S("/usr/share/xsessions/default.desktop"),     _S("Name of the session for the last logged-in user.\n"
                                                                                                    "This session will be preselected when the login screen appears."));
             Entry(User,            QString,     QString(),                                      _S("Name of the last logged-in user.\n"
                                                                                                    "This user will be preselected when the login screen appears"));
Index: sddm-0.14.0/src/common/Constants.h.in
===================================================================
--- sddm-0.14.0.orig/src/common/Constants.h.in
+++ sddm-0.14.0/src/common/Constants.h.in
@@ -33,6 +33,7 @@
 #define WAYLAND_SESSION_COMMAND     "@WAYLAND_SESSION_COMMAND@"
 
 #define CONFIG_FILE                 "@CONFIG_FILE@"
+#define DISPLAY_MANAGER_CONFIG_FILE "@DISPLAY_MANAGER_CONFIG_FILE@"
 #define LOG_FILE                    "@LOG_FILE@"
 #define PID_FILE                    "@PID_FILE@"
 #define MINIMUM_VT                  @MINIMUM_VT@
Index: sddm-0.14.0/src/daemon/Display.cpp
===================================================================
--- sddm-0.14.0.orig/src/daemon/Display.cpp
+++ sddm-0.14.0/src/daemon/Display.cpp
@@ -35,6 +35,7 @@
 #include <QDebug>
 #include <QFile>
 #include <QTimer>
+#include <QSettings>
 
 #include <pwd.h>
 #include <unistd.h>
@@ -139,8 +140,19 @@ namespace SDDM {
         // log message
         qDebug() << "Display server started.";
 
+        QSettings sysconfSettings(QStringLiteral(DISPLAY_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