Steam Performance Issues

  • Date:

I have been plagued by intermittent game performance issues when running Steam. The source of the issues is "steamwebhelper" which is used for rendering HTML content in the Steam UI. Since this is a critical component of Steam, it cannot be disabled by, for example, modifying the permissions of the binary so it can no longer be executed. I resolved the issues by writing a simple script:

#!/usr/bin/env bash
trap 'pkill -SIGCONT -x steamwebhelper' EXIT

while sleep 1; do
    xprop_output="$(xprop -root 32x ' $0' _NET_ACTIVE_WINDOW)" || continue
    active_window_id="${xprop_output##* }"

    # Pause the Steam UI when the user is running a Steam game.
    case "$(xprop -id "$active_window_id")" in
      *$'\nSTEAM_GAME(CARDINAL) = 769\n'*)
        pkill -SIGCONT -x steamwebhelper
      ;;
      *$'\nSTEAM_GAME(CARDINAL) = '*|*'WM_CLASS(STRING) = "steam_app_0",'*)
        pkill -SIGSTOP -x steamwebhelper
      ;;
      *)
        pkill -SIGCONT -x steamwebhelper
      ;;
    esac
done

The script periodically checks to see if the foreground window is an application launched by Steam. If it is, it sends SIGSTOP to all steamwebhelper processes to suspend their execution. Otherwise, it sends SIGCONT to those processes to resume execution. Because steamwebhelper is required by the Steam overlay, I recommend disabling the overlay.