From 68f76f63d40bec42aca587f3a1717460052ae41d Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sun, 17 Dec 2023 13:00:24 -0500 Subject: [PATCH] Use KSandbox to wrap in flatpak host spawn if needed --- launcher/src/gamerunner.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/launcher/src/gamerunner.cpp b/launcher/src/gamerunner.cpp index 5e934a5..b596e8e 100644 --- a/launcher/src/gamerunner.cpp +++ b/launcher/src/gamerunner.cpp @@ -3,6 +3,8 @@ #include "gamerunner.h" +#include + #ifdef ENABLE_GAMEMODE #include #endif @@ -283,10 +285,6 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con env.insert(QStringLiteral("MVK_CONFIG_USE_METAL_ARGUMENT_BUFFERS"), QString::number(1)); } -#if defined(FLATPAK) - arguments.push_back(QStringLiteral("flatpak-spawn")); - arguments.push_back(QStringLiteral("--host")); -#endif arguments.push_back(profile.winePath()); } #endif @@ -301,7 +299,13 @@ void GameRunner::launchExecutable(const Profile &profile, QProcess *process, con process->setProcessEnvironment(env); - process->start(executable, arguments); + // Wrap in flatpak host spawn if needed + if (KSandbox::isInside()) { + const auto context = KSandbox::makeHostContext(*process); + process->start(context.program, context.arguments); + } else { + process->start(executable, arguments); + } } void GameRunner::addRegistryKey(const Profile &settings, QString key, QString value, QString data)