diff --git a/tools/mangoapp/mangoapp b/tools/mangoapp/mangoapp index 4d541f73e..e912be1a8 100644 --- a/tools/mangoapp/mangoapp +++ b/tools/mangoapp/mangoapp @@ -5,4 +5,17 @@ # WAYLAND_DISPLAY as Wayland-only, and unset, libwayland falls back to wayland-0 - DroidDeck's own # compositor, which shares XDG_RUNTIME_DIR - so both fail; x11 makes GLFW use gamescope's X server. export XDG_SESSION_TYPE=x11 +# gamescope's reaper restarts mangoapp the moment it exits, with no backoff. One that dies at start +# (a stale session preload without the System V queue, a driver it crashes on) was started about +# once a second for the whole session, each start a full exec under proot - the Steam menu itself +# lagged. More than 5 starts in 60 s leaves the overlay off: this waits instead of exiting, so the +# reaper has nothing to restart until the session ends. +starts=/tmp/droiddeck-mangoapp-starts +now=$(date +%s) +recent=$(awk -v now="$now" '$1 > now - 60' "$starts" 2>/dev/null) +printf '%s\n%s\n' "$recent" "$now" | sed '/^$/d' > "$starts" +if [ "$(wc -l < "$starts")" -gt 5 ]; then + echo "mangoapp: started $(wc -l < "$starts") times in 60 s; the performance overlay stays off for this session" >&2 + exec sleep infinity +fi LD_LIBRARY_PATH=/usr/local/lib/mangoapp${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} exec /usr/local/lib/mangoapp/mangoapp "$@"