summaryrefslogtreecommitdiff
path: root/user/sddm/session-env.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2022-08-19 22:26:54 -0500
committerZach van Rijn <me@zv.io>2022-10-21 18:34:02 -0500
commit40526154b709a62f45c832c02fb5d1ef56e16754 (patch)
treed0551f5e9fb34557ac3d16b62d1c24e0568e7e07 /user/sddm/session-env.patch
parentc27ed30b35be8092053a8e7210d10b4e0a8792e8 (diff)
downloadpackages-40526154b709a62f45c832c02fb5d1ef56e16754.tar.gz
packages-40526154b709a62f45c832c02fb5d1ef56e16754.tar.bz2
packages-40526154b709a62f45c832c02fb5d1ef56e16754.tar.xz
packages-40526154b709a62f45c832c02fb5d1ef56e16754.zip
user/sddm: Update to 0.19.0
Fixes: #368, #646
Diffstat (limited to 'user/sddm/session-env.patch')
-rw-r--r--user/sddm/session-env.patch122
1 files changed, 122 insertions, 0 deletions
diff --git a/user/sddm/session-env.patch b/user/sddm/session-env.patch
new file mode 100644
index 000000000..e73ab8fc4
--- /dev/null
+++ b/user/sddm/session-env.patch
@@ -0,0 +1,122 @@
+From 093e8e54c7de33c2d7332cc3a126041263e1aa71 Mon Sep 17 00:00:00 2001
+From: davidedmundson <kde@davidedmundson.co.uk>
+Date: Mon, 8 Mar 2021 07:35:55 +0000
+Subject: [PATCH] Allow addition env vars to be defined in session files
+ (#1370)
+
+We have a continual problem with developers using Plasma in custom
+prefixes. We need to set mulitple additional envs and it is a constant
+pain point.
+
+Setting XDG_DATA_DIRS and alike in a script in the Exec line of the
+desktop file doesn't work properly, as this is after systemd and dbus
+have already been started during pam_logind. It is currently very bodged
+with more manual steps.
+
+Things will work much better if we can set the env before pam_logind is
+run.
+
+Using pam_env or profile.d doesn't work as that affects all the
+sessions.
+
+It is not intended to be used for anything other than dev setups.
+---
+ src/common/Session.cpp | 24 ++++++++++++++++++++++++
+ src/common/Session.h | 5 +++++
+ src/daemon/Display.cpp | 1 +
+ 3 files changed, 30 insertions(+)
+
+diff --git a/src/common/Session.cpp b/src/common/Session.cpp
+index 3de28ef13..0aa540221 100644
+--- a/src/common/Session.cpp
++++ b/src/common/Session.cpp
+@@ -107,6 +107,10 @@ namespace SDDM {
+ return m_isNoDisplay;
+ }
+
++ QProcessEnvironment Session::additionalEnv() const {
++ return m_additionalEnv;
++ }
++
+ void Session::setTo(Type type, const QString &_fileName)
+ {
+ QString fileName(_fileName);
+@@ -178,6 +182,8 @@ namespace SDDM {
+ m_isHidden = line.mid(7).toLower() == QLatin1String("true");
+ if (line.startsWith(QLatin1String("NoDisplay=")))
+ m_isNoDisplay = line.mid(10).toLower() == QLatin1String("true");
++ if (line.startsWith(QLatin1String("X-SDDM-Env=")))
++ m_additionalEnv = parseEnv(line.mid(strlen("X-SDDM-Env=")));
+ }
+
+ file.close();
+@@ -191,4 +197,22 @@ namespace SDDM {
+ setTo(other.type(), other.fileName());
+ return *this;
+ }
++
++ QProcessEnvironment SDDM::Session::parseEnv(const QString &list)
++ {
++ QProcessEnvironment env;
++
++ const QVector<QStringRef> entryList = list.splitRef(QLatin1Char(','));
++ for (const auto &entry: entryList) {
++ int midPoint = entry.indexOf(QLatin1Char('='));
++ if (midPoint < 0) {
++ qWarning() << "Malformed entry in" << fileName() << ":" << entry;
++ continue;
++ }
++ env.insert(entry.left(midPoint).toString(), entry.mid(midPoint+1).toString());
++ }
++ return env;
++ }
++
++
+ }
+diff --git a/src/common/Session.h b/src/common/Session.h
+index 9fd86cd02..aa196e9c6 100644
+--- a/src/common/Session.h
++++ b/src/common/Session.h
+@@ -23,6 +23,7 @@
+ #include <QDataStream>
+ #include <QDir>
+ #include <QSharedPointer>
++#include <QProcessEnvironment>
+
+ namespace SDDM {
+ class SessionModel;
+@@ -59,11 +60,14 @@ namespace SDDM {
+ bool isHidden() const;
+ bool isNoDisplay() const;
+
++ QProcessEnvironment additionalEnv() const;
++
+ void setTo(Type type, const QString &name);
+
+ Session &operator=(const Session &other);
+
+ private:
++ QProcessEnvironment parseEnv(const QString &list);
+ bool m_valid;
+ Type m_type;
+ QDir m_dir;
+@@ -75,6 +79,7 @@ namespace SDDM {
+ QString m_tryExec;
+ QString m_xdgSessionType;
+ QString m_desktopNames;
++ QProcessEnvironment m_additionalEnv;
+ bool m_isHidden;
+ bool m_isNoDisplay;
+
+diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
+index 9f1fabc68..a65df3f0b 100644
+--- a/src/daemon/Display.cpp
++++ b/src/daemon/Display.cpp
+@@ -313,6 +313,7 @@ namespace SDDM {
+ qDebug() << "Session" << m_sessionName << "selected, command:" << session.exec();
+
+ QProcessEnvironment env;
++ env.insert(session.additionalEnv());
+
+ if (seat()->name() == QLatin1String("seat0")) {
+ // Use the greeter VT, for wayland sessions the helper overwrites this