Files
middleclick-autoscroll/res/systemd/middleclick-autoscroll.path
T
Felitendo b7e0ff6fd1 fix: make the Steam patch survive Steam's own file check
Steam's autoscroll worked, except when it didn't. Every report of that came
down to the same thing: Steam started in a way that carried no -noverifyfiles,
noticed the patched web helper script, put its own copy back, and spent the
session without the flag. There is no way to make every possible way of
starting Steam carry an argument - a game launcher, a shortcut, a terminal,
another program calling `steam steam://` - so the patch stops depending on it.

The check is on size and timestamp, not on content, so the patch is now written
to look untouched: the bytes the flag costs come back out of the script's own
comments, and the timestamp of the untouched copy is restored afterwards. The
file Steam finds is exactly as long and exactly as old as the one it wrote. A
client that verifies its files finds nothing to repair. -noverifyfiles stays as
the fallback for a script with no comments left to pay for the flag.

Two things fall out of that. A patch that keeps the size no longer has to wait
for Steam to close, because there is no size mismatch for the client to chase;
only the growing one still defers. And an installation patched by the earlier
version is quietly redone at the original size on the next apply, so the fix
arrives without anyone having to know about it.

Then the launch paths that were never covered:

- Shortcuts on the desktop itself. Nothing in the XDG search path looks at
  that folder, so nothing had ever seen them - and Steam writes one there for
  every game somebody asks for a shortcut to. Its name is translated, so it is
  read from user-dirs.dirs and handed to the watcher in a drop-in.
- Steam as a Flatpak was never recognised as Steam, so its entry got nothing
  while its script got patched - the worst of both. The switch goes after the
  application id there, where flatpak passes it on rather than reading it.
- steam-native and steam-jupiter, which are ordinary Steam starts under
  another name, and Flatpak and snap entries in ~/.config/autostart.

Two things found on the way: a client update left the undo copy holding the
script from before the update, so undoing would have put an old version back;
and a shortcut edited in place and later deleted would have been recreated by
`disable`.
2026-09-01 13:21:57 +02:00

44 lines
2.0 KiB
SYSTEMD

[Unit]
Description=Watch for newly installed Chromium-based applications
Documentation=man:middleclick-autoscroll(1)
[Path]
# Every way an application can turn up: a package, a Flatpak, a snap, something
# installed by hand. Watching where the launchers land means there is no hook
# to write per package manager - pacman, apt, dnf, zypper, flatpak, snapd and
# an AppImage manager all end up here.
#
# A directory that does not exist on this system costs nothing: systemd watches
# the nearest parent that does and picks the path up when it appears.
PathModified=/usr/share/applications
PathModified=/usr/local/share/applications
PathModified=%h/.local/share/applications
PathModified=%h/.config/autostart
PathModified=/var/lib/flatpak/exports/share/applications
PathModified=%h/.local/share/flatpak/exports/share/applications
PathModified=/var/lib/snapd/desktop/applications
# NixOS and Guix build the search path out of profiles rather than /usr.
PathModified=/run/current-system/sw/share/applications
PathModified=%h/.nix-profile/share/applications
PathModified=%h/.guix-profile/share/applications
# The desktop folder is watched too - Steam writes a shortcut there for every
# game somebody asks for one, and starting a game is a Steam start - but its
# name is translated and cannot be written down here. `enable` adds it in a
# drop-in, from the name this system uses.
# 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.
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
Unit=middleclick-autoscroll.service
[Install]
WantedBy=default.target