diff --git a/src/krunner/CMakeLists.txt b/src/krunner/CMakeLists.txt index fef94d5..f304929 100644 --- a/src/krunner/CMakeLists.txt +++ b/src/krunner/CMakeLists.txt @@ -14,6 +14,7 @@ if(KF6Runner_FOUND) KF6::I18n Qt6::Core Qt6::Gui + Qt6::DBus ) else() message(STATUS "KRunner not found, skipping KRunner plugin") diff --git a/src/krunner/alakarterunner.cpp b/src/krunner/alakarterunner.cpp index 92d0104..8a7fa69 100644 --- a/src/krunner/alakarterunner.cpp +++ b/src/krunner/alakarterunner.cpp @@ -4,6 +4,9 @@ #include "alakarterunner.h" #include +#include +#include +#include #include #include #include @@ -149,13 +152,31 @@ void AlakarteRunner::run(const KRunner::RunnerContext &context, const KRunner::Q return; } - // Handle Steam URLs - if (command.startsWith(QLatin1String("steam://"))) { + // Always try daemon first for all commands (including Steam/Lutris) + if (!match.id().isEmpty()) { + QDBusInterface iface(QStringLiteral("org.kde.GameCenter1"), + QStringLiteral("/org/kde/GameCenter1"), + QStringLiteral("org.kde.GameCenter1"), + QDBusConnection::sessionBus()); + QVariantMap launchSpec = { + {QStringLiteral("command"), command}, + {QStringLiteral("gameId"), match.id()}, + {QStringLiteral("displayName"), match.text()}, + {QStringLiteral("origin"), QStringLiteral("krunner")}, + }; + + const QDBusReply reply = iface.call(QStringLiteral("Launch"), launchSpec); + if (reply.isValid() && !reply.value().isEmpty()) { + return; + } + } + + // Fallback: daemon unavailable or no game ID + if (command.startsWith(QLatin1String("steam://")) || command.startsWith(QLatin1String("lutris:"))) { QProcess::startDetached(QStringLiteral("xdg-open"), {command}); return; } - // Handle other commands QStringList args = QProcess::splitCommand(command); if (!args.isEmpty()) { QString program = args.takeFirst();