diff --git a/quickshell/Modals/DLauncherV2/ControllerUtils.js b/quickshell/Modals/DLauncherV2/ControllerUtils.js index 33790650e..4dd5ae541 100644 --- a/quickshell/Modals/DLauncherV2/ControllerUtils.js +++ b/quickshell/Modals/DLauncherV2/ControllerUtils.js @@ -116,7 +116,7 @@ function classifyAppSource(app) { if (cmd0 === "flatpak" || exec.indexOf("flatpak run ") !== -1) return "flatpak"; - if (cmd0 === "snap" || exec.indexOf("bamf_desktop_file_hint=") !== -1 || exec.indexOf("/snap/bin/") !== -1 || exec.indexOf("/snap/core") !== -1 || exec.indexOf("snap run ") === 0) + if (cmd0 === "snap" || exec.indexOf("/snap/bin/") !== -1 || exec.indexOf("/snap/core") !== -1 || exec.indexOf("snap run ") === 0) return "snap"; if (/\.appimage(\s|$|")/i.test(execRaw) || id.indexOf("appimagekit_") === 0) diff --git a/quickshell/tests/launcher-app-source.test.mjs b/quickshell/tests/launcher-app-source.test.mjs new file mode 100644 index 000000000..67e59be63 --- /dev/null +++ b/quickshell/tests/launcher-app-source.test.mjs @@ -0,0 +1,17 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { loadScript } from "./qml-script.mjs"; + +const utils = loadScript(new URL("../Modals/DLauncherV2/ControllerUtils.js", import.meta.url)); + +test("app source follows the binary, not BAMF_DESKTOP_FILE_HINT", () => { + const cases = [ + ["env BAMF_DESKTOP_FILE_HINT=/nix/store/abc-codex/share/applications/codex.desktop /nix/store/abc-codex/bin/codex %u", "nix"], + ["env BAMF_DESKTOP_FILE_HINT=/usr/share/applications/foo.desktop /usr/bin/foo", "system"], + ["env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/firefox_firefox.desktop /snap/bin/firefox %u", "snap"], + ["snap run spotify", "snap"], + ["/nix/store/def-chrome/bin/google-chrome-stable %U", "nix"] + ]; + for (const [exec, source] of cases) + assert.equal(utils.classifyAppSource({ id: "app", execString: exec }), source, exec); +});