#!/bin/bash # One-click "Join" for Project Reclaimer on Linux (Proton / umu / Wine). From prstatus.ibigs.us, 2026-10-17. # # Reclaimer 0.9.18+ understands reclaimer://join/, but it registers that link inside Wine, where your # browser can't see it. This script registers it with your Linux desktop instead (for your user only, no root): # ~/.local/bin/reclaimer-join runs your game with the link # ~/.local/share/applications/reclaimer-join.desktop tells the desktop to use it for reclaimer:// links # ~/.config/reclaimer-join.conf where your game and its Wine prefix are # Game closed: it starts the game, which joins once the menu is up. Game open: it hands the server to the # running game through the same Wine prefix (no second launcher, no waiting). # # Usage: bash linux-join.sh asks for your game and prefix (finds common setups itself) # bash linux-join.sh --uninstall removes the three files above set -euo pipefail BIN="$HOME/.local/bin/reclaimer-join" DESK="$HOME/.local/share/applications/reclaimer-join.desktop" CONF="$HOME/.config/reclaimer-join.conf" if [ "${1:-}" = "--uninstall" ]; then rm -f "$BIN" "$DESK" "$CONF" command -v update-desktop-database >/dev/null && update-desktop-database "$HOME/.local/share/applications" || true echo "Removed. reclaimer:// links are no longer handled by Project Reclaimer." exit 0 fi say() { printf '%s\n' "$*"; } ask() { local q="$1" def="$2" a; read -r -p "$q [${def}]: " a /dev/null | head -1 || true) fi EXE=$(ask "Path to project-reclaimer.exe" "${EXE:-}") [ -f "$EXE" ] || { say "Can't find $EXE. Run this again with the right path."; exit 1; } # 2. the Wine prefix the game runs in (umu/Proton nest the real one in /pfx) PFX="${WINEPREFIX:-}" for c in "$(dirname "$EXE")/prefix" "$HOME/Games/umu/project-reclaimer" "$HOME/.wine"; do [ -z "$PFX" ] && [ -d "$c" ] && PFX="$c" done PFX=$(ask "Wine prefix the game uses" "${PFX:-$HOME/.wine}") [ -d "$PFX" ] || { say "No folder $PFX. Run this again with the right prefix."; exit 1; } # 3. how to start it when it is not running: your own launcher if you have one, else umu-run / wine LAUNCH="" [ -x "$(dirname "$EXE")/launch.sh" ] && LAUNCH="$(dirname "$EXE")/launch.sh" [ -z "$LAUNCH" ] && command -v umu-run >/dev/null && LAUNCH="umu-run" [ -z "$LAUNCH" ] && LAUNCH="wine" LAUNCH=$(ask "Command that starts the game (gets the link as its argument)" "$LAUNCH") # 4. a Wine to hand links to the running game: Proton's own if the prefix is a Proton one WINEBIN="" for c in "${PROTONPATH:-}/files/bin/wine" "$HOME"/.local/share/Steam/compatibilitytools.d/*/files/bin/wine \ "$HOME"/.local/share/Steam/steamapps/common/Proton*/files/bin/wine; do [ -x "$c" ] && WINEBIN="$c" done command -v wine >/dev/null && [ -z "$WINEBIN" ] && WINEBIN="$(command -v wine)" mkdir -p "$(dirname "$BIN")" "$(dirname "$DESK")" "$(dirname "$CONF")" { printf 'EXE=%q\nPFX=%q\nLAUNCH=%q\nWINEBIN=%q\n' "$EXE" "$PFX" "$LAUNCH" "$WINEBIN" } > "$CONF" cat > "$BIN" <<'EOS' #!/bin/bash # reclaimer-join : open a Project Reclaimer join link (see ~/.config/reclaimer-join.conf) set -uo pipefail LINK="${1:-}" case "$LINK" in reclaimer:*) ;; *) echo "not a reclaimer:// link" >&2; exit 2 ;; esac # shellcheck source=/dev/null . "$HOME/.config/reclaimer-join.conf" LOG=/tmp/reclaimer-join.log echo "$(date '+%F %T') $LINK" >> "$LOG" REAL="$PFX"; [ -d "$PFX/pfx" ] && REAL="$PFX/pfx" running=0; W="${WINEBIN:-}" for pid in $(pgrep -x wineserver 2>/dev/null); do p=$(tr '\0' '\n' < "/proc/$pid/environ" 2>/dev/null | sed -n 's/^WINEPREFIX=//p' | head -1) case "${p%/}" in "${PFX%/}"|"${REAL%/}") running=1 # the running game's own Wine build (a different one refuses: "wineserver version mismatch") s=$(readlink "/proc/$pid/exe" 2>/dev/null); [ -x "$(dirname "$s")/wine" ] && W="$(dirname "$s")/wine" ;; esac done if [ "$running" = 1 ] && pgrep -f 'project-reclaimer\.exe' >/dev/null && [ -n "$W" ]; then # the game is open: a second copy started with the link hands it over and exits WINEPREFIX="$REAL" WINEDEBUG=-all "$W" "$EXE" "$LINK" >> "$LOG" 2>&1 & exit 0 fi cd "$(dirname "$EXE")" || exit 1 case "$LAUNCH" in umu-run) WINEPREFIX="$PFX" GAMEID="${GAMEID:-project-reclaimer}" setsid umu-run "$EXE" "$LINK" >> "$LOG" 2>&1 & ;; wine) WINEPREFIX="$REAL" setsid wine "$EXE" "$LINK" >> "$LOG" 2>&1 & ;; *) setsid "$LAUNCH" "$LINK" >> "$LOG" 2>&1 & ;; esac EOS chmod 755 "$BIN" cat > "$DESK" </dev/null && update-desktop-database "$HOME/.local/share/applications" || true say "" say "Done. Join buttons on prstatus.ibigs.us now open Project Reclaimer." say " Handler: $(xdg-mime query default x-scheme-handler/reclaimer)" say " Test it: xdg-open 'reclaimer://join/75.98.127.229:49400'" say " Log: /tmp/reclaimer-join.log Remove: bash linux-join.sh --uninstall" say "Your browser asks once whether to open Project Reclaimer; allow it (and tick 'always')."