File 0001-Don-t-add-session-files-with-NoDisplay-true-to-Sessi.patch of Package sddm
From 9f72d78cd729b76bac96a79ab767b02e30b118c7 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 14 May 2018 10:06:34 +0200
Subject: [PATCH] Don't add session files with NoDisplay=true to SessionModel
Same treatment as for Hidden. SessionModel is not used for autologin,
so for all intents and purposes it's the same. If a user logged in with
a NoDisplay=true session, the last session index will be incorrect, but
IMO that's the intended behaviour of NoDisplay.
---
src/common/Session.cpp | 8 ++++++++
src/common/Session.h | 2 ++
src/greeter/SessionModel.cpp | 2 +-
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/common/Session.cpp b/src/common/Session.cpp
index 4812d67..aa4dad3 100644
--- a/src/common/Session.cpp
+++ b/src/common/Session.cpp
@@ -32,6 +32,7 @@ namespace SDDM {
: m_valid(false)
, m_type(UnknownSession)
, m_isHidden(false)
+ , m_isNoDisplay(false)
{
}
@@ -111,6 +112,11 @@ namespace SDDM {
return m_isHidden;
}
+ bool Session::isNoDisplay() const
+ {
+ return m_isNoDisplay;
+ }
+
void Session::setTo(Type type, const QString &_fileName)
{
QString fileName(_fileName);
@@ -177,6 +183,8 @@ namespace SDDM {
m_desktopNames = line.mid(13).replace(QLatin1Char(';'), QLatin1Char(':'));
if (line.startsWith(QLatin1String("Hidden=")))
m_isHidden = line.mid(7).toLower() == QLatin1String("true");
+ if (line.startsWith(QLatin1String("NoDisplay=")))
+ m_isNoDisplay = line.mid(10).toLower() == QLatin1String("true");
}
file.close();
diff --git a/src/common/Session.h b/src/common/Session.h
index c8c527e..d285a3f 100644
--- a/src/common/Session.h
+++ b/src/common/Session.h
@@ -60,6 +60,7 @@ namespace SDDM {
QString desktopNames() const;
bool isHidden() const;
+ bool isNoDisplay() const;
void setTo(Type type, const QString &name);
@@ -79,6 +80,7 @@ namespace SDDM {
QString m_xdgSessionType;
QString m_desktopNames;
bool m_isHidden;
+ bool m_isNoDisplay;
friend class SessionModel;
};
diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp
index 27e8c40..2a3c091 100644
--- a/src/greeter/SessionModel.cpp
+++ b/src/greeter/SessionModel.cpp
@@ -143,7 +143,7 @@ namespace SDDM {
}
}
// add to sessions list
- if (!si->isHidden() && execAllowed)
+ if (!si->isHidden() && !si->isNoDisplay() && execAllowed)
d->sessions.push_back(si);
else
delete si;
--
2.16.2