From 497a3984a91a9c88e388d1fc89d496e83ce68c36 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 13 Jan 2022 21:16:29 +0000 Subject: [PATCH] [kde-systemd-start-condition] Always return success on non Plasma If invoked on gnome we should always return success this is because a desktop file that has X-KDE-AutostartCondition probably has an X-Gnome- equivalent and we only want one to run this would match non systemd behaviour. See also: https://github.com/systemd/systemd/pull/22115 --- startkde/systemd/kde-systemd-start-condition.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/startkde/systemd/kde-systemd-start-condition.cpp b/startkde/systemd/kde-systemd-start-condition.cpp index 3256ce454..ddd179039 100644 --- a/startkde/systemd/kde-systemd-start-condition.cpp +++ b/startkde/systemd/kde-systemd-start-condition.cpp @@ -12,6 +12,14 @@ int main(int argc, char **argv) { QCoreApplication app(argc, argv); + + // If invoked on gnome we should always return success + // this is because a desktop file that has X-KDE-AutostartCondition + // probably has an X-Gnome- equivalent and we only want one to run + // this would match non systemd behaviour + if (!qEnvironmentVariable("XDG_CURRENT_DESKTOP").split(QLatin1Char(':')).contains("kde", Qt::CaseInsensitive)) { + return 0; + } QCommandLineParser parser; parser.setApplicationDescription(QStringLiteral("Checks start condition for a KDE systemd service")); parser.addHelpOption();