You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.5 KiB
61 lines
2.5 KiB
From 2e2ba14e8a74ea7834f797e30b130b35fa5f2e0f Mon Sep 17 00:00:00 2001
|
|
From: Neal Gompa <ngompa13@gmail.com>
|
|
Date: Thu, 22 Apr 2021 22:45:41 -0400
|
|
Subject: [PATCH] greeter: Do not populate Wayland sessions if they are to be
|
|
hidden
|
|
|
|
Check for a file on disk that indicates that the Wayland sessions
|
|
are to be hidden. This is useful for cases where it has been
|
|
determined automatically that the system cannot run Wayland sessions.
|
|
---
|
|
src/greeter/SessionModel.cpp | 14 ++++++++++----
|
|
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp
|
|
index 1953c76..36ccc22 100644
|
|
--- a/src/greeter/SessionModel.cpp
|
|
+++ b/src/greeter/SessionModel.cpp
|
|
@@ -22,6 +22,7 @@
|
|
|
|
#include "Configuration.h"
|
|
|
|
+#include <QFileInfo>
|
|
#include <QVector>
|
|
#include <QProcessEnvironment>
|
|
#include <QFileSystemWatcher>
|
|
@@ -39,22 +40,27 @@ namespace SDDM {
|
|
};
|
|
|
|
SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) {
|
|
+ // Check for flag to hide Wayland sessions
|
|
+ bool waylandHiddenFlag = QFileInfo::exists(QStringLiteral("/etc/sddm/hide-wayland-sessions"));
|
|
// initial population
|
|
beginResetModel();
|
|
- populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
|
|
+ if (!waylandHiddenFlag)
|
|
+ populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
|
|
populate(Session::X11Session, mainConfig.X11.SessionDir.get());
|
|
endResetModel();
|
|
|
|
// refresh everytime a file is changed, added or removed
|
|
QFileSystemWatcher *watcher = new QFileSystemWatcher(this);
|
|
- connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path) {
|
|
+ connect(watcher, &QFileSystemWatcher::directoryChanged, [waylandHiddenFlag, this](const QString &path) {
|
|
beginResetModel();
|
|
d->sessions.clear();
|
|
- populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
|
|
+ if (!waylandHiddenFlag)
|
|
+ populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
|
|
populate(Session::X11Session, mainConfig.X11.SessionDir.get());
|
|
endResetModel();
|
|
});
|
|
- watcher->addPath(mainConfig.Wayland.SessionDir.get());
|
|
+ if (!waylandHiddenFlag)
|
|
+ watcher->addPath(mainConfig.Wayland.SessionDir.get());
|
|
watcher->addPath(mainConfig.X11.SessionDir.get());
|
|
}
|
|
|
|
--
|
|
2.31.1
|
|
|