From 796b3894065f2fa80ab6b8c2db6001ff3be6ae96 Mon Sep 17 00:00:00 2001 From: Kyuyrii Date: Mon, 23 Feb 2026 13:59:20 -0300 Subject: [PATCH 1/3] Changing the .desktop command when using the Snap version. --- rare/utils/paths.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rare/utils/paths.py b/rare/utils/paths.py index ce1cf1dca4..ee19e3c1da 100644 --- a/rare/utils/paths.py +++ b/rare/utils/paths.py @@ -324,8 +324,13 @@ def create_desktop_link(app_name: str, app_title: str = "", link_name: str = "", logger.info(f"Creating shortcut for {app_title} at {shortcut_path}") if platform.system() in {"Linux", "FreeBSD"}: - executable = get_rare_executable() - executable = shlex.join(executable) + + if os.environ.get("SNAP"): + executable = "snap run rare" + else: + executable = get_rare_executable() + executable = shlex.join(executable) + if not for_rare: executable = f"{executable} launch {app_name}" From 6f807b03499e875ac1bb5c77d57a65add3421db3 Mon Sep 17 00:00:00 2001 From: Kyuyrii Date: Mon, 23 Feb 2026 17:53:52 -0300 Subject: [PATCH 2/3] Changing the command used by the Flatpak version. --- rare/utils/paths.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rare/utils/paths.py b/rare/utils/paths.py index ee19e3c1da..ac8eb562ee 100644 --- a/rare/utils/paths.py +++ b/rare/utils/paths.py @@ -327,6 +327,8 @@ def create_desktop_link(app_name: str, app_title: str = "", link_name: str = "", if os.environ.get("SNAP"): executable = "snap run rare" + elif os.environ.get("container") == "flatpak": + executable = "flatpak run io.github.dummerle.rare" else: executable = get_rare_executable() executable = shlex.join(executable) From 35d084f88557621996fba6a1b92e079082f7e2b3 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Mon, 23 Feb 2026 23:07:42 +0200 Subject: [PATCH 3/3] paths: update `get_rare_executable()` to handle Flatpak and Snap packaging In the case of desktop shortcuts or Steam shortcuts we need to invoke the Flatpak or Snap packages in their respective ways since we are not already in the container. For these cases we need `get_rare_executable` to return the command to run Rare externally. There are other cases when we need to invoke one of Rare's sub-applications from inside the container that we don't need to do this, hence the `external` parameter was introduced. Fixes: https://github.com/RareDevs/Rare/issues/609 Co-Authored-By: Kyuyrii --- rare/utils/paths.py | 29 +++++++++++++++++++---------- rare/utils/steam_shortcuts.py | 2 +- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/rare/utils/paths.py b/rare/utils/paths.py index ac8eb562ee..973c812755 100644 --- a/rare/utils/paths.py +++ b/rare/utils/paths.py @@ -243,8 +243,22 @@ def desktop_link_path(link_name: str, link_type: str) -> Path: return __link_type[link_type].joinpath(f"{link_name}.{__link_suffix[platform.system()]['link']}") -def get_rare_executable() -> List[str]: +def get_rare_executable(*, external: bool = False) -> List[str]: + """ + Returns the command list to invoke Rare for different platforms and packaging solutions + When used with container based packaging, such as Flatpak or Snap, returns the command + invoke Rare outside of the container + + :param external: if True return the command to invoke Rare through Flatpak or Snap, defaults to false + :return: command list + """ logger.debug(f"Trying to find executable: {sys.executable}, {sys.argv}") + + if os.environ.get("SNAP") and external: + return ["snap", "run", "rare"] + if os.environ.get("container") == "flatpak" and external: + return ["flatpak", "run", "io.github.dummerle.rare"] + # lk: detect if nuitka if "__compiled__" in globals(): executable = [sys.executable] @@ -324,15 +338,8 @@ def create_desktop_link(app_name: str, app_title: str = "", link_name: str = "", logger.info(f"Creating shortcut for {app_title} at {shortcut_path}") if platform.system() in {"Linux", "FreeBSD"}: - - if os.environ.get("SNAP"): - executable = "snap run rare" - elif os.environ.get("container") == "flatpak": - executable = "flatpak run io.github.dummerle.rare" - else: - executable = get_rare_executable() - executable = shlex.join(executable) - + executable = get_rare_executable(external=True) + executable = shlex.join(executable) if not for_rare: executable = f"{executable} launch {app_name}" @@ -377,3 +384,5 @@ def create_desktop_link(app_name: str, app_title: str = "", link_name: str = "", shortcut.save() return True + + return False diff --git a/rare/utils/steam_shortcuts.py b/rare/utils/steam_shortcuts.py index ebb4ca7629..4510d37ee1 100644 --- a/rare/utils/steam_shortcuts.py +++ b/rare/utils/steam_shortcuts.py @@ -152,7 +152,7 @@ def add_steam_shortcut(app_name: str, app_title: str) -> SteamShortcut: logger.info("Removing old Steam shortcut for %s", app_name) remove_steam_shortcut(app_name) - command = get_rare_executable() + command = get_rare_executable(external=True) arguments = ["launch", app_name] if len(command) > 1: arguments = command[1:] + arguments