fix: restart compression delay for new games

This commit is contained in:
Kurt Himebauch committed 2026-10-26 11:55:01 -04:00
1 parent 36135327f5
commit d08afbd878
2 files changed
+35 -4

No files matched your search

@@ -552,6 +552,7 @@ case $mode in
}
# Proton starts its reaper before the game window; compressing during launch stalls it.
# Desktop Steam has no focus.json, so it still uses the game process as its trigger.
# A configured RAM cap can still force compression while a game is launching.
bl_game_focused() {
if [ "${BL_DESKTOP:-}" = 1 ] || [ -z "${BL_LAUNCH_DIR:-}" ]; then
return 0
@@ -575,7 +576,7 @@ case $mode in
bl_cap_due() {
[ "$_bl_ram_cap" -gt 0 ] && { [ "$_bl_measured" -lt 0 ] || [ $((SECONDS - _bl_measured)) -ge 30 ]; }
}
_bl_since=-1 _bl_packed=-1 _bl_measured=-1 _bl_unpack=0 _bl_capped=-1 _bl_backoff=30
_bl_since=-1 _bl_since_apps= _bl_packed=-1 _bl_measured=-1 _bl_unpack=0 _bl_capped=-1 _bl_backoff=30
while kill -0 $$ 2>/dev/null; do
bl_zram_scan
if bl_cap_due; then
@@ -607,7 +608,9 @@ case $mode in
fi
fi
if [ "$_bl_game" = 1 ] && bl_game_focused; then
[ "$_bl_since" -ge 0 ] || _bl_since=$SECONDS
if [ "$_bl_since" -lt 0 ] || [ "$_bl_since_apps" != "$_bl_apps" ]; then
_bl_since=$SECONDS _bl_since_apps=$_bl_apps
fi
if [ "${BL_ZRAM_CLIENT:-1}" = 1 ] && [ $((SECONDS - _bl_since)) -ge 20 ] && [ "${#_bl_pids[@]}" -gt 0 ] &&
{ [ "$_bl_packed" -lt 0 ] || [ $((SECONDS - _bl_packed)) -ge 300 ]; }; then
bl_zram_send 1 "compressing the client" client