Enable hiding Wayland sessions with a flag file (#1952431)

epel9
Neal Gompa 4 years ago
parent 27d6022c46
commit 73e31f8a13

@ -0,0 +1,60 @@
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

@ -33,3 +33,6 @@ fi
if [ -f "/var/lib/sddm/state.conf" ]; then if [ -f "/var/lib/sddm/state.conf" ]; then
sed -e "s|^Session=/usr/share/wayland-sessions/plasma.*|Session=/usr/share/xsessions/${X11_SESSION_NAME}|" -i /var/lib/sddm/state.conf sed -e "s|^Session=/usr/share/wayland-sessions/plasma.*|Session=/usr/share/xsessions/${X11_SESSION_NAME}|" -i /var/lib/sddm/state.conf
fi fi
# Tell SDDM that Wayland sessions are to be hidden
touch /etc/sddm/hide-wayland-sessions

@ -9,7 +9,7 @@
Name: sddm Name: sddm
Version: 0.19.0 Version: 0.19.0
Release: 11%{?dist} Release: 12%{?dist}
License: GPLv2+ License: GPLv2+
Summary: QML based X11 desktop manager Summary: QML based X11 desktop manager
@ -46,6 +46,10 @@ Patch101: sddm-0.19.0-fedora_config.patch
# sddm.service: +EnvironmentFile=-/etc/sysconfig/sddm # sddm.service: +EnvironmentFile=-/etc/sysconfig/sddm
Patch103: sddm-0.18.0-environment_file.patch Patch103: sddm-0.18.0-environment_file.patch
# For the udev rules to allow disabling wayland sessions
# https://bugzilla.redhat.com/1952431
Patch104: sddm-0.19.0-allow-hiding-wayland-sessions.patch
# Shamelessly stolen from gdm # Shamelessly stolen from gdm
Source11: sddm.pam Source11: sddm.pam
# Shamelessly stolen from gdm # Shamelessly stolen from gdm
@ -162,6 +166,9 @@ rm -fv %{buildroot}%{_sysconfdir}/sddm/Xsession
install -Dpm 644 %{SOURCE17} %{buildroot}%{_udevrulesdir}/61-sddm-plasmawayland.rules install -Dpm 644 %{SOURCE17} %{buildroot}%{_udevrulesdir}/61-sddm-plasmawayland.rules
install -Dpm 755 %{SOURCE18} %{buildroot}%{_libexecdir}/sddm-disable-plasmawayland install -Dpm 755 %{SOURCE18} %{buildroot}%{_libexecdir}/sddm-disable-plasmawayland
# ghost file for runtime wayland session hide flag
touch %{buildroot}%{_sysconfdir}/sddm/hide-wayland-sessions
%pre %pre
getent group sddm >/dev/null || groupadd -r sddm getent group sddm >/dev/null || groupadd -r sddm
getent passwd sddm >/dev/null || \ getent passwd sddm >/dev/null || \
@ -231,6 +238,7 @@ fi
%{_tmpfilesdir}/sddm.conf %{_tmpfilesdir}/sddm.conf
%{_udevrulesdir}/61-sddm-plasmawayland.rules %{_udevrulesdir}/61-sddm-plasmawayland.rules
%{_libexecdir}/sddm-disable-plasmawayland %{_libexecdir}/sddm-disable-plasmawayland
%ghost %{_sysconfdir}/sddm/hide-wayland-sessions
%attr(0711, root, sddm) %dir %{_localstatedir}/run/sddm %attr(0711, root, sddm) %dir %{_localstatedir}/run/sddm
%attr(1770, sddm, sddm) %dir %{_localstatedir}/lib/sddm %attr(1770, sddm, sddm) %dir %{_localstatedir}/lib/sddm
%{_unitdir}/sddm.service %{_unitdir}/sddm.service
@ -254,6 +262,9 @@ fi
%changelog %changelog
* Thu Apr 22 2021 Neal Gompa <ngompa13@gmail.com> - 0.19.0-12
- Enable hiding Wayland sessions with a flag file (#1952431)
* Thu Apr 22 2021 Neal Gompa <ngompa13@gmail.com> - 0.19.0-11 * Thu Apr 22 2021 Neal Gompa <ngompa13@gmail.com> - 0.19.0-11
- Add auto-fallback hack for when KMS isn't available (#1952431) - Add auto-fallback hack for when KMS isn't available (#1952431)

Loading…
Cancel
Save