Files
TapTapLootForwarder/taptaploot-forward.sh
2026-04-23 14:09:55 +10:00

31 lines
787 B
Bash

#!/bin/bash
# Launches TapTapLoot in rootful Xwayland
# Steam launch option: ~/.local/bin/taptaploot-forward.sh %command%
for i in $(seq 10 30); do
if [ ! -e "/tmp/.X11-unix/X$i" ]; then
GAME_DISPLAY=":$i"
break
fi
done
GAME_XAUTH=$(mktemp /tmp/taptaploot-xauth.XXXXXX)
COOKIE=$(mcookie)
xauth -f "$GAME_XAUTH" add "$GAME_DISPLAY" . "$COOKIE"
cleanup() {
kill "$XWAYLAND_PID" 2>/dev/null
wait "$XWAYLAND_PID" 2>/dev/null
rm -f "$GAME_XAUTH"
}
trap cleanup EXIT INT TERM
# Change the resolution here if you would like it larger or smaller
XAUTHORITY="$GAME_XAUTH" Xwayland "$GAME_DISPLAY" -geometry 800x600 -noreset -auth "$GAME_XAUTH" &
XWAYLAND_PID=$!
sleep 1
DISPLAY="$GAME_DISPLAY" XAUTHORITY="$GAME_XAUTH" "$@" &
GAME_PID=$!
wait "$GAME_PID"