2021-10-29 16:21:40 +02:00
|
|
|
diff --git a/src/common/Configuration.h b/src/common/Configuration.h
|
2023-06-23 16:41:57 +02:00
|
|
|
index 54bcace..49cf5cb 100644
|
2021-10-29 16:21:40 +02:00
|
|
|
--- a/src/common/Configuration.h
|
|
|
|
+++ b/src/common/Configuration.h
|
2023-06-23 16:41:57 +02:00
|
|
|
@@ -48,6 +48,8 @@ namespace SDDM {
|
2021-10-29 16:21:40 +02:00
|
|
|
Entry(InputMethod, QString, QStringLiteral("qtvirtualkeyboard"), _S("Input method module"));
|
|
|
|
Entry(Namespaces, QStringList, QStringList(), _S("Comma-separated list of Linux namespaces for user session to enter"));
|
2023-06-23 16:41:57 +02:00
|
|
|
Entry(GreeterEnvironment, QStringList, QStringList(), _S("Comma-separated list of environment variables to be set"));
|
2021-10-29 16:21:40 +02:00
|
|
|
+ Entry(DefaultSession, QString, QString(), _S("System-wide default session"));
|
2023-06-23 16:41:57 +02:00
|
|
|
+
|
2021-10-29 16:21:40 +02:00
|
|
|
// Name Entries (but it's a regular class again)
|
|
|
|
Section(Theme,
|
|
|
|
Entry(ThemeDir, QString, _S(DATA_INSTALL_DIR "/themes"), _S("Theme directory path"));
|
|
|
|
diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp
|
2023-06-23 16:41:57 +02:00
|
|
|
index d8698b7..df3e3c4 100644
|
2021-10-29 16:21:40 +02:00
|
|
|
--- a/src/greeter/SessionModel.cpp
|
|
|
|
+++ b/src/greeter/SessionModel.cpp
|
2023-06-23 16:41:57 +02:00
|
|
|
@@ -49,6 +49,7 @@ namespace SDDM {
|
|
|
|
if (dri_active)
|
|
|
|
populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
|
2021-10-29 16:21:40 +02:00
|
|
|
populate(Session::X11Session, mainConfig.X11.SessionDir.get());
|
|
|
|
+ selectDefaultSession();
|
|
|
|
endResetModel();
|
2023-06-23 16:41:57 +02:00
|
|
|
|
2021-10-29 16:21:40 +02:00
|
|
|
// refresh everytime a file is changed, added or removed
|
2023-06-23 16:41:57 +02:00
|
|
|
@@ -62,6 +63,7 @@ namespace SDDM {
|
|
|
|
if (dri_active)
|
|
|
|
populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
|
2021-10-29 16:21:40 +02:00
|
|
|
populate(Session::X11Session, mainConfig.X11.SessionDir.get());
|
|
|
|
+ selectDefaultSession();
|
|
|
|
endResetModel();
|
|
|
|
});
|
2023-06-23 16:41:57 +02:00
|
|
|
watcher->addPaths(mainConfig.Wayland.SessionDir.get());
|
|
|
|
@@ -164,11 +166,25 @@ namespace SDDM {
|
2021-10-29 16:21:40 +02:00
|
|
|
delete si;
|
2023-06-23 16:41:57 +02:00
|
|
|
}
|
2021-10-29 16:21:40 +02:00
|
|
|
}
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void SessionModel::selectDefaultSession() {
|
|
|
|
+ d->lastIndex = 0;
|
|
|
|
+
|
|
|
|
// find out index of the last session
|
|
|
|
for (int i = 0; i < d->sessions.size(); ++i) {
|
|
|
|
if (d->sessions.at(i)->fileName() == stateConfig.Last.Session.get()) {
|
|
|
|
d->lastIndex = i;
|
|
|
|
- break;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Otherwise, fallback to system-wide default session.
|
|
|
|
+ auto defaultSession = mainConfig.DefaultSession.get();
|
|
|
|
+ for (int i = 0; i < d->sessions.size(); ++i) {
|
|
|
|
+ if (QFileInfo(d->sessions.at(i)->fileName()).fileName() == defaultSession) {
|
|
|
|
+ d->lastIndex = i;
|
|
|
|
+ return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/greeter/SessionModel.h b/src/greeter/SessionModel.h
|
2023-06-23 16:41:57 +02:00
|
|
|
index 8f4d539..02f77ce 100644
|
2021-10-29 16:21:40 +02:00
|
|
|
--- a/src/greeter/SessionModel.h
|
|
|
|
+++ b/src/greeter/SessionModel.h
|
2023-06-23 16:41:57 +02:00
|
|
|
@@ -59,6 +59,7 @@ namespace SDDM {
|
2021-10-29 16:21:40 +02:00
|
|
|
SessionModelPrivate *d { nullptr };
|
2023-06-23 16:41:57 +02:00
|
|
|
|
|
|
|
void populate(Session::Type type, const QStringList &dirPaths);
|
2021-10-29 16:21:40 +02:00
|
|
|
+ void selectDefaultSession();
|
|
|
|
};
|
|
|
|
}
|