diff --git a/bottles/backend/globals.py b/bottles/backend/globals.py index 152afd4194..d925125f58 100644 --- a/bottles/backend/globals.py +++ b/bottles/backend/globals.py @@ -20,7 +20,7 @@ from functools import lru_cache from pathlib import Path from typing import Dict - +from bottles.backend.utils import yaml, json @lru_cache class Paths: @@ -79,6 +79,9 @@ class TrdyPaths: mangohud_available = shutil.which("mangohud") or False obs_vkc_available = shutil.which("obs-vkcapture") or False vmtouch_available = shutil.which("vmtouch") or False +base_version = "" +if os.path.isfile("/app/manifest.json"): + base_version = json.load(open("/app/manifest.json")).get("base-version","").removeprefix("stable-") # encoding detection correction, following windows defaults locale_encodings: Dict[str, str] = { diff --git a/bottles/frontend/views/bottle_preferences.py b/bottles/frontend/views/bottle_preferences.py index 7f5e9cb96f..7d1454cdcf 100644 --- a/bottles/frontend/views/bottle_preferences.py +++ b/bottles/frontend/views/bottle_preferences.py @@ -23,7 +23,7 @@ from gi.repository import Gtk, Adw from bottles.backend.globals import gamemode_available, vkbasalt_available, mangohud_available, obs_vkc_available, \ - vmtouch_available, gamescope_available + vmtouch_available, gamescope_available, base_version from bottles.backend.logger import Logger from bottles.backend.managers.library import LibraryManager from bottles.backend.managers.runtime import RuntimeManager @@ -194,11 +194,15 @@ def __init__(self, details, config, **kwargs): self.switch_vmtouch.set_sensitive(vmtouch_available) _not_available = _("This feature is unavailable on your system.") _flatpak_not_available = _("{} To add this feature, please run flatpak install").format(_not_available) + _gamescope_pkg_name = "org.freedesktop.Platform.VulkanLayer.gamescope" + _vkbasalt_pkg_name = "org.freedesktop.Platform.VulkanLayer.vkBasalt" + _mangohud_pkg_name = "org.freedesktop.Platform.VulkanLayer.MangoHud" + _obsvkc_pkg_name = "com.obsproject.Studio.Plugin.OBSVkCapture" _flatpak_pkg_name = { - "gamescope": "org.freedesktop.Platform.VulkanLayer.gamescope", - "vkbasalt": "org.freedesktop.Platform.VulkanLayer.vkBasalt//22.08", - "mangohud": "org.freedesktop.Platform.VulkanLayer.MangoHud//22.08", - "obsvkc": "com.obsproject.Studio.Plugin.OBSVkCapture" + "gamescope": f"{_gamescope_pkg_name}//{base_version}" if base_version else _gamescope_pkg_name, + "vkbasalt": f"{_vkbasalt_pkg_name}//{base_version}" if base_version else _vkbasalt_pkg_name, + "mangohud": f"{_mangohud_pkg_name}//{base_version}" if base_version else _mangohud_pkg_name, + "obsvkc": _obsvkc_pkg_name } if not gamemode_available: