diff options
| author | SulfurNitride <lukew19@proton.me> | 2026-06-25 20:17:26 -0500 |
|---|---|---|
| committer | SulfurNitride <lukew19@proton.me> | 2026-06-25 20:17:26 -0500 |
| commit | 9455355871a03639dc6c69b4ff0a14e2dc2b72bb (patch) | |
| tree | 13048ea61f1de4e4bca8ee1178ef53c801a732ab /src | |
| parent | a881dcd7fde12b070009ca79ba13fd3e8d8cf2d8 (diff) | |
Preserve Steam shortcut ID for Game Mode launches
Diffstat (limited to 'src')
| -rw-r--r-- | src/src/protonlauncher.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/src/protonlauncher.cpp b/src/src/protonlauncher.cpp index e8c2a89..42e2525 100644 --- a/src/src/protonlauncher.cpp +++ b/src/src/protonlauncher.cpp @@ -746,6 +746,23 @@ bool ProtonLauncher::launchWithProton(qint64& pid) const // what umu-launcher uses and ensures the previous session is fully cleaned up // before starting a new one. const QStringList protonArgs = QStringList() << "waitforexitandrun" << m_binary << m_arguments; + const QString targetAppId = + m_steamAppId == 0 ? QString{} : QString::number(m_steamAppId); + const QString inheritedSteamGameId = + QProcessEnvironment::systemEnvironment().value("SteamGameId").trimmed(); + const QString launchSteamGameId = + !targetAppId.isEmpty() && !inheritedSteamGameId.isEmpty() && + inheritedSteamGameId != targetAppId + ? inheritedSteamGameId + : targetAppId; + + if (!targetAppId.isEmpty() && launchSteamGameId != targetAppId) { + MOBase::log::debug( + "preserving inherited SteamGameId '{}' for Steam/Game Mode focus " + "tracking while launching Proton app id '{}'", + launchSteamGameId, targetAppId); + } + QStringList pressureVesselImportantPaths; pressureVesselImportantPaths << m_binary << m_workingDir << m_gameDirectory << m_prefixPath << m_bindMountSource @@ -799,10 +816,9 @@ bool ProtonLauncher::launchWithProton(qint64& pid) const } } if (m_steamAppId != 0) { - const QString appId = QString::number(m_steamAppId); - containerCmd << QStringLiteral("STEAM_COMPAT_APP_ID=%1").arg(appId) - << QStringLiteral("SteamAppId=%1").arg(appId) - << QStringLiteral("SteamGameId=%1").arg(appId); + containerCmd << QStringLiteral("STEAM_COMPAT_APP_ID=%1").arg(targetAppId) + << QStringLiteral("SteamAppId=%1").arg(targetAppId) + << QStringLiteral("SteamGameId=%1").arg(launchSteamGameId); } containerCmd << protonScript << protonArgs; @@ -847,10 +863,9 @@ bool ProtonLauncher::launchWithProton(qint64& pid) const } if (m_steamAppId != 0) { - const QString appId = QString::number(m_steamAppId); - env.insert("STEAM_COMPAT_APP_ID", appId); - env.insert("SteamAppId", appId); - env.insert("SteamGameId", appId); + env.insert("STEAM_COMPAT_APP_ID", targetAppId); + env.insert("SteamAppId", targetAppId); + env.insert("SteamGameId", launchSteamGameId); } // When Steam DRM is disabled (e.g. GOG games), set UMU_ID so that |
