summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-10 15:11:51 -0400
committerxXJSONDeruloXx <danielhimebauch@gmail.com>2026-09-10 15:11:51 -0400
commita7b7e22968480c0b57f9a0335ee30e27baa9b88d (patch)
tree80a7b5bdf76a23cc108563c694d9a4b9fc31dfa1
parent29dc8a0a243147c26ca49494155ae089b0c6fd80 (diff)
downloaddecky-lsfg-vk-a7b7e22968480c0b57f9a0335ee30e27baa9b88d.tar.gz
decky-lsfg-vk-a7b7e22968480c0b57f9a0335ee30e27baa9b88d.zip
fix: canonicalize existing Flatpak targetsrefactor/flatpak-capability
-rw-r--r--src/utils/steamLaunchOptions.ts12
-rw-r--r--tests/steamLaunchOptions.test.ts31
2 files changed, 42 insertions, 1 deletions
diff --git a/src/utils/steamLaunchOptions.ts b/src/utils/steamLaunchOptions.ts
index ea97a10..0c24887 100644
--- a/src/utils/steamLaunchOptions.ts
+++ b/src/utils/steamLaunchOptions.ts
@@ -428,11 +428,21 @@ export function installWrapperIntegration(
if (savedOriginal && savedOriginal !== managedOriginal) {
throw new Error("Shortcut Target changed externally; refusing to replace it");
}
+ const canonicalTarget = flatpakTargetValue(wrapperPath, managedOriginal);
+ let targetChanged = false;
+ if (current.target !== canonicalTarget) {
+ current = await writeVerified(
+ appId, true, current.target, canonicalTarget,
+ (target) => writeTarget(appId, target), readTarget,
+ "Steam did not accept the canonical Flatpak shortcut Target",
+ );
+ targetChanged = true;
+ }
return {
snapshot: current,
originalExecutable: savedOriginal || managedOriginal,
commandTokenAdded: false,
- changed: launchOptionsChanged,
+ changed: launchOptionsChanged || targetChanged,
};
}
const currentOriginal = selectFlatpakExecutable(transport, current.target);
diff --git a/tests/steamLaunchOptions.test.ts b/tests/steamLaunchOptions.test.ts
index 0559330..cdf0cf2 100644
--- a/tests/steamLaunchOptions.test.ts
+++ b/tests/steamLaunchOptions.test.ts
@@ -192,6 +192,37 @@ test("wraps a split direct Flatpak target while preserving its launch arguments"
}
});
+test("canonicalizes an existing quoted direct Flatpak target", async () => {
+ const previousWindow = (globalThis as Record<string, unknown>).window;
+ const previousSteamClient = (globalThis as Record<string, unknown>).SteamClient;
+ let shortcutTarget = '"~/.lsfg" "/usr/bin/flatpak"';
+ const targetWrites: string[] = [];
+ const apps = {
+ RegisterForAppDetails(_appId: number, callback: (details: SteamAppDetails) => void) {
+ callback({ strShortcutExe: shortcutTarget, strShortcutLaunchOptions: "" });
+ return { unregister() {} };
+ },
+ SetShortcutExe(_appId: number, executable: string) {
+ targetWrites.push(executable);
+ shortcutTarget = executable;
+ },
+ SetShortcutLaunchOptions() {},
+ };
+ (globalThis as Record<string, unknown>).window = { setTimeout, clearTimeout };
+ (globalThis as Record<string, unknown>).SteamClient = { Apps: apps };
+ try {
+ const installed = await installWrapperIntegration(47, true, wrapper, false, { kind: "flatpak" });
+ assert.equal(installed.originalExecutable, "/usr/bin/flatpak");
+ assert.equal(installed.snapshot.target, "~/.lsfg /usr/bin/flatpak");
+ assert.deepEqual(targetWrites, ["~/.lsfg /usr/bin/flatpak"]);
+ } finally {
+ if (previousWindow === undefined) delete (globalThis as Record<string, unknown>).window;
+ else (globalThis as Record<string, unknown>).window = previousWindow;
+ if (previousSteamClient === undefined) delete (globalThis as Record<string, unknown>).SteamClient;
+ else (globalThis as Record<string, unknown>).SteamClient = previousSteamClient;
+ }
+});
+
test("uses shortcut launch options for a host shortcut without changing its Target", async () => {
const previousWindow = (globalThis as Record<string, unknown>).window;
const previousSteamClient = (globalThis as Record<string, unknown>).SteamClient;