Files
DroidDeck/tools/linuxfs/overlay/usr/local/bin/droiddeck-game-gpu
T
MaxsTechReview 1760f008ae fix(desktop): Flatpak and Snap apps get the game GPU setting (#2295)
The session's TU_DEBUG=sysmem is meant for the Steam client and
Chromium-based apps. Flatpak and Snap apps inherited it, so emulators
and other programs installed that way rendered through system memory.

droiddeck-game-env now holds the Chromium check next to game_gpu, and a
small droiddeck-game-gpu wrapper applies both to any program. The
AppImage, Flatpak and Snap launchers use it, so the rule lives in one
place.
2026-11-08 14:39:31 -05:00

43 lines
1.2 KiB
Python
Executable File

#!/usr/bin/python3
import os
import runpy
import sys
BIN_DIR = os.path.dirname(os.path.abspath(__file__))
def main(argv):
keep = False
folder = None
while argv and argv[0] != "--":
if argv[0] == "--chromium":
keep = True
argv = argv[1:]
elif argv[0] == "--for" and len(argv) > 1:
folder = argv[1]
argv = argv[2:]
else:
break
if argv and argv[0] == "--":
argv = argv[1:]
if not argv:
print("usage: droiddeck-game-gpu [--chromium] [--for FOLDER] -- PROGRAM [ARGS...]", file=sys.stderr)
return 2
env = dict(os.environ)
try:
game_env = runpy.run_path(os.path.join(BIN_DIR, "droiddeck-game-env"))
if folder and not keep:
keep = game_env["chromium_app"](folder)
env = game_env["game_gpu"](env, keep)
except Exception as error:
print("droiddeck-game-gpu: the game GPU setting was not applied (%s)" % error, file=sys.stderr)
try:
os.execvpe(argv[0], argv, env)
except OSError as error:
print("droiddeck-game-gpu: %s: %s" % (argv[0], error.strerror), file=sys.stderr)
return 127
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))