From aa385fb08fe6c61e51c2d1ce97fa14c24178d89b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 27 Apr 2022 17:01:49 +0200 Subject: [PATCH] xdgactivation: Make sure we don't call setStartupId with an x11 token Besides not working on Wayland, it will prevent the job from fetching a working token. --- applets/kicker/plugin/appentry.cpp | 5 ++++- applets/kicker/plugin/recentusagemodel.cpp | 5 ++++- libtaskmanager/launchertasksmodel.cpp | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/applets/kicker/plugin/appentry.cpp b/applets/kicker/plugin/appentry.cpp index 2e60749a9..6f24d1dab 100644 --- a/applets/kicker/plugin/appentry.cpp +++ b/applets/kicker/plugin/appentry.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -213,7 +214,9 @@ bool AppEntry::run(const QString &actionId, const QVariant &argument) auto *job = new KIO::ApplicationLauncherJob(m_service); job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled)); job->setRunFlags(KIO::ApplicationLauncherJob::DeleteTemporaryFiles); - job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp)); + if (KWindowSystem::isPlatformX11()) { + job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp)); + } job->start(); KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("applications:") + m_service->storageId()), QStringLiteral("org.kde.plasma.kicker")); diff --git a/applets/kicker/plugin/recentusagemodel.cpp b/applets/kicker/plugin/recentusagemodel.cpp index 0f7f656cc..8920479c9 100644 --- a/applets/kicker/plugin/recentusagemodel.cpp +++ b/applets/kicker/plugin/recentusagemodel.cpp @@ -41,6 +41,7 @@ #include #include #include +#include namespace KAStats = KActivities::Stats; @@ -400,7 +401,9 @@ bool RecentUsageModel::trigger(int row, const QString &actionId, const QVariant auto *job = new KIO::ApplicationLauncherJob(service); job->setUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled)); - job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp)); + if (KWindowSystem::isPlatformX11()) { + job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp)); + } job->start(); KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("applications:") + storageId), QStringLiteral("org.kde.plasma.kicker")); diff --git a/libtaskmanager/launchertasksmodel.cpp b/libtaskmanager/launchertasksmodel.cpp index 4f1907f90..7ac05fe5b 100644 --- a/libtaskmanager/launchertasksmodel.cpp +++ b/libtaskmanager/launchertasksmodel.cpp @@ -573,7 +573,9 @@ void LauncherTasksModel::requestOpenUrls(const QModelIndex &index, const QListsetUiDelegate(new KNotificationJobUiDelegate(KJobUiDelegate::AutoErrorHandlingEnabled)); job->setUrls(urls); - job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp)); + if (KWindowSystem::isPlatformX11()) { + job->setStartupId(KStartupInfo::createNewStartupIdForTimestamp(timeStamp)); + } job->start(); KActivities::ResourceInstance::notifyAccessed(QUrl(QStringLiteral("applications:") + service->storageId()), QStringLiteral("org.kde.libtaskmanager"));