File 0002-Ignore-session-desktop-files-with-the-Hidden-propert.patch of Package sddm
From 1ba30952b942050fe55a9d9c76c615f72f6fcd04 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 11 May 2017 09:34:31 +0200
Subject: [PATCH 2/3] Ignore session desktop files with the Hidden property set
to true
They are still read in the autologin case.
Fixes issue #820
---
src/common/Session.cpp | 9 +++++++++
src/common/Session.h | 3 +++
src/greeter/SessionModel.cpp | 2 +-
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/common/Session.cpp b/src/common/Session.cpp
index 5c2892a..4812d67 100644
--- a/src/common/Session.cpp
+++ b/src/common/Session.cpp
@@ -31,10 +31,12 @@ namespace SDDM {
Session::Session()
: m_valid(false)
, m_type(UnknownSession)
+ , m_isHidden(false)
{
}
Session::Session(Type type, const QString &fileName)
+ : Session()
{
setTo(type, fileName);
}
@@ -104,6 +106,11 @@ namespace SDDM {
return m_desktopNames;
}
+ bool Session::isHidden() const
+ {
+ return m_isHidden;
+ }
+
void Session::setTo(Type type, const QString &_fileName)
{
QString fileName(_fileName);
@@ -168,6 +175,8 @@ namespace SDDM {
m_tryExec = line.mid(8);
if (line.startsWith(QLatin1String("DesktopNames=")))
m_desktopNames = line.mid(13).replace(QLatin1Char(';'), QLatin1Char(':'));
+ if (line.startsWith(QLatin1String("Hidden=")))
+ m_isHidden = line.mid(7).toLower() == QLatin1String("true");
}
file.close();
diff --git a/src/common/Session.h b/src/common/Session.h
index 7ce1e9a..c8c527e 100644
--- a/src/common/Session.h
+++ b/src/common/Session.h
@@ -59,6 +59,8 @@ namespace SDDM {
QString desktopSession() const;
QString desktopNames() const;
+ bool isHidden() const;
+
void setTo(Type type, const QString &name);
Session &operator=(const Session &other);
@@ -76,6 +78,7 @@ namespace SDDM {
QString m_tryExec;
QString m_xdgSessionType;
QString m_desktopNames;
+ bool m_isHidden;
friend class SessionModel;
};
diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp
index d3ace84..27e8c40 100644
--- a/src/greeter/SessionModel.cpp
+++ b/src/greeter/SessionModel.cpp
@@ -143,7 +143,7 @@ namespace SDDM {
}
}
// add to sessions list
- if (execAllowed)
+ if (!si->isHidden() && execAllowed)
d->sessions.push_back(si);
else
delete si;
--
2.12.0