diff --git a/doc/middleclick-autoscroll.1.scd b/doc/middleclick-autoscroll.1.scd index d144cd4..89e6f57 100644 --- a/doc/middleclick-autoscroll.1.scd +++ b/doc/middleclick-autoscroll.1.scd @@ -133,6 +133,12 @@ helper, inside Steam's own installation: ~/.local/share/Steam/ubuntu12_64/steamwebhelper_sniper_wrap.sh +The steamrt3 client, a beta for now, has a script of its own: + + ~/.local/share/Steam/steamrt64/steamwebhelper.sh + +Both are patched where both are there, so switching clients keeps autoscroll. + Where that installation is depends on how Steam was installed: _~/.local/share/Steam_ for Valve's own package and Arch's, _~/.steam/debian-installation_ for Debian's, and the private tree of the @@ -154,11 +160,16 @@ it was given arguments for, and that one carries no arguments of anybody's. One wrong length costs the whole client package downloaded, extracted and installed again, and a client that quits at the end of it instead of coming up. -So where the comments cannot pay for the argument, or a client update has -changed how the helper is started, nothing is written and the status screen -says Steam is not patched. Nothing goes on Steam's launcher entry, its -autostart entry or the shortcuts it writes for single games either, and Steam -goes on repairing its own installation. +The steamrt3 script has no comments to pay with. So it is copied aside as +_steamwebhelper.sh.orig_, and a stub of the same size takes its place. The stub +runs the copy with the argument added. Steam only checks the files it knows, +and the copy is not one of them. + +So where neither fits, or a client update has changed how the helper is +started, nothing is written and the status screen says Steam is not patched. +Nothing goes on Steam's launcher entry, its autostart entry or the shortcuts it +writes for single games either, and Steam goes on repairing its own +installation. An installation patched by an earlier version, which appended where the comments were short, is written again to fit at the next apply, or taken back diff --git a/res/systemd/middleclick-autoscroll.path b/res/systemd/middleclick-autoscroll.path index b4eee3b..8977d3a 100644 --- a/res/systemd/middleclick-autoscroll.path +++ b/res/systemd/middleclick-autoscroll.path @@ -30,12 +30,17 @@ PathModified=%h/.guix-profile/share/applications # Steam replaces the script that starts its interface on every client update, # which takes the patch with it. Where that installation lives depends on how -# Steam was installed. +# Steam was installed. The steamrt3 client has a script of its own. PathChanged=%h/.local/share/Steam/ubuntu12_64/steamwebhelper_sniper_wrap.sh PathChanged=%h/.steam/debian-installation/ubuntu12_64/steamwebhelper_sniper_wrap.sh PathChanged=%h/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steamwebhelper_sniper_wrap.sh PathChanged=%h/.var/app/com.valvesoftware.Steam/data/Steam/ubuntu12_64/steamwebhelper_sniper_wrap.sh PathChanged=%h/snap/steam/common/.local/share/Steam/ubuntu12_64/steamwebhelper_sniper_wrap.sh +PathChanged=%h/.local/share/Steam/steamrt64/steamwebhelper.sh +PathChanged=%h/.steam/debian-installation/steamrt64/steamwebhelper.sh +PathChanged=%h/.var/app/com.valvesoftware.Steam/.local/share/Steam/steamrt64/steamwebhelper.sh +PathChanged=%h/.var/app/com.valvesoftware.Steam/data/Steam/steamrt64/steamwebhelper.sh +PathChanged=%h/snap/steam/common/.local/share/Steam/steamrt64/steamwebhelper.sh Unit=middleclick-autoscroll.service diff --git a/src/lib/steam.sh b/src/lib/steam.sh index d3ec4de..45a6516 100644 --- a/src/lib/steam.sh +++ b/src/lib/steam.sh @@ -9,6 +9,10 @@ # # ~/.local/share/Steam/ubuntu12_64/steamwebhelper_sniper_wrap.sh # +# The steamrt3 client, a beta for now, has a script of its own: +# +# ~/.local/share/Steam/steamrt64/steamwebhelper.sh +# # Steam compares the installed files against its manifest at every start (by # size and timestamp, not by content) and restores whatever differs. # So the patch is written to look untouched: the bytes the flag costs are taken @@ -28,6 +32,10 @@ # all: no autoscroll in the interface is a smaller thing than a client that # reinstalls itself. # +# The steamrt3 script has no comments to give back. So it is copied aside, as +# it is, and replaced by a stub of the same size that runs the copy with the +# flag. See _mca_steam_stub. +# # The file comes back on every client update, and the watcher re-applies the # patch when that happens. @@ -60,24 +68,28 @@ mca_steam_roots() { done } -# The script to patch inside a Steam installation. Newer clients start the -# helper through a wrapper inside the container runtime; older ones exec it -# from steamwebhelper.sh directly, and that one forwards its arguments too. -mca_steam_script() { - local root="$1" f +# The scripts to patch inside a Steam installation, one per client. The default +# client starts the helper through a wrapper inside the container runtime; +# older ones exec it from steamwebhelper.sh directly, and that one forwards its +# arguments too. The steamrt3 client has its own. Both clients are patched +# where both are there, so switching between them keeps autoscroll. +mca_steam_scripts() { + local root="$1" f found=1 for f in \ "$root/ubuntu12_64/steamwebhelper_sniper_wrap.sh" \ "$root/ubuntu12_64/steamwebhelper.sh" do - [[ -f $f && -w $f ]] && { printf '%s\n' "$f"; return 0; } + [[ -f $f && -w $f ]] && { printf '%s\n' "$f"; found=0; break; } done - return 1 + f="$root/steamrt64/steamwebhelper.sh" + [[ -f $f && -w $f ]] && { printf '%s\n' "$f"; found=0; } + return "$found" } mca_steam_installed() { local root while IFS= read -r root; do - mca_steam_script "$root" > /dev/null && return 0 + mca_steam_scripts "$root" > /dev/null && return 0 done < <(mca_steam_roots) return 1 } @@ -87,13 +99,17 @@ mca_steam_script_patched() { grep -q -- "$MCA_FEATURE" "$1" 2>/dev/null } +# Whether every script there is patched. One that is not is a client that +# starts without autoscroll. mca_steam_patched() { - local root script + local root script found=0 while IFS= read -r root; do - script="$(mca_steam_script "$root")" || continue - mca_steam_script_patched "$script" && return 0 + while IFS= read -r script; do + mca_steam_script_patched "$script" || return 1 + found=1 + done < <(mca_steam_scripts "$root") done < <(mca_steam_roots) - return 1 + (( found )) } # _mca_steam_exec_line