summaryrefslogtreecommitdiff
path: root/sddm-0.19.0-allow-hiding-wayland-sessions.patch
blob: 9eb550e324f75300b6fb1dda6ab1326629d03879 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From 0b5040a887459a974bb4a3a4512a8392daa0eb66 Mon Sep 17 00:00:00 2001
From: Jeremy Linton <jeremy.linton@arm.com>
Date: Mon, 25 Oct 2021 14:56:14 -0500
Subject: [PATCH] greeter: Do not populate Wayland sessions if they are to be
 hidden

Check for /dev/dri which should indicate that the Wayland will work
on this hardware.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
---
 src/greeter/SessionModel.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp
index 1953c76..b1f3296 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,18 +40,25 @@ namespace SDDM {
     };
 
     SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) {
+        // Check for flag to hide Wayland sessions
+        bool dri_active = QFileInfo::exists(QStringLiteral("/dev/dri"));
+
         // initial population
         beginResetModel();
-        populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
+        if (dri_active)
+            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) {
+            // Recheck for flag to hide Wayland sessions
+            bool dri_active = QFileInfo::exists(QStringLiteral("/dev/dri"));
             beginResetModel();
             d->sessions.clear();
-            populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
+            if (dri_active)
+                populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
             populate(Session::X11Session, mainConfig.X11.SessionDir.get());
             endResetModel();
         });
-- 
2.32.0