diff --git a/ui/steamify-app.sh b/ui/steamify-app.sh index c77f21c..95f428b 100755 --- a/ui/steamify-app.sh +++ b/ui/steamify-app.sh @@ -71,4 +71,9 @@ EOF command -v update-desktop-database >/dev/null && update-desktop-database "$APPS" 2>/dev/null || true say "Starting Steamify..." +# Started from Steam: stay in the foreground, or Steam counts the game as +# ended right away and stops giving it the controller. +if [[ -n "${SteamGameId:-}" ]]; then + exec "$DEST/ui/steamify-ui" < /dev/null +fi setsid "$DEST/ui/steamify-ui" >/dev/null 2>&1 < /dev/null & diff --git a/ui/steamify-ui b/ui/steamify-ui index 8fa4310..8da4519 100755 --- a/ui/steamify-ui +++ b/ui/steamify-ui @@ -20,6 +20,14 @@ import tempfile import threading import time +# Started from Steam (a non-Steam game, so Steam Input hands it the +# controller): Steam preloads its overlay into every game, and Qt aborts with +# it loaded. Start again without it, before Qt is imported. +if "gameoverlayrenderer" in os.environ.get("LD_PRELOAD", ""): + os.environ["LD_PRELOAD"] = ":".join(p for p in os.environ["LD_PRELOAD"].split(":") + if p and "gameoverlayrenderer" not in p) + os.execv(sys.executable, [sys.executable] + sys.argv) + HERE = os.path.dirname(os.path.realpath(__file__)) try: