Files
DeeJanuz--frametop/scripts/frame.sh
T
DeeJanuzandClaude Opus 5.5 4d845492e7 Let the headset sleep with the helper idle; keep the container out of our units
With the pointer released, the helper still listed overlays by running
vrcmd every second, a new SteamVR client each time, which kept SteamVR
from going to standby. The list now pauses while the pointer is off.

Starting the dev container from one of our services made that service own
it, so stopping the service stopped the container and the desktop's
compositor with it. scripts/container-up.sh starts the container in a
systemd scope of its own before every distrobox enter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 17:56:45 -06:00

45 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Run a command on the Steam Frame, inside the "dev" distrobox by default.
# On the Frame itself it runs locally in this checkout; from a PC it runs over SSH
# in the synced copy (see scripts/_env.sh).
# Usage: scripts/frame.sh [--host] [-C subdir] command [args...]
# --host run on the SteamOS host instead of the container
# -C subdir start in <repo>/<subdir> (default: the repo root)
# The command is passed to a shell as one string, like ssh does.
set -euo pipefail
. "$(dirname "${BASH_SOURCE[0]}")/_env.sh"
on_host=0
sub=
while [ $# -gt 0 ]; do
case $1 in
--host) on_host=1; shift ;;
-C) sub=$2; shift 2 ;;
--) shift; break ;;
*) break ;;
esac
done
[ $# -gt 0 ] || { echo "usage: $0 [--host] [-C subdir] command [args...]" >&2; exit 2; }
dir=$FRAME_REPO${sub:+/$sub}
# distrobox is called by its full path: ~/.bashrc on the Frame returns early for
# non-interactive shells, so ~/.local/bin isn't on PATH. distrobox enter keeps the cwd.
if [ "$FRAME_LOCAL" = 1 ]; then
cd "$dir"
if [ "$on_host" = 1 ]; then
exec bash -c "$*"
fi
"$REPO_ROOT/scripts/container-up.sh" # in a scope of its own, not this shell's session
exec "$HOME/.local/bin/distrobox" enter "$FRAME_BOX" -- bash -lc "$*"
fi
tty=()
[ -t 0 ] && [ -t 1 ] && tty=(-t)
if [ "$on_host" = 1 ]; then
exec ssh "${tty[@]}" "$FRAME_HOST" "cd $(printf %q "$dir") && $*"
else
exec ssh "${tty[@]}" "$FRAME_HOST" \
"$(printf %q "$FRAME_REPO")/scripts/container-up.sh; cd $(printf %q "$dir") && ~/.local/bin/distrobox enter $(printf %q "$FRAME_BOX") -- bash -lc $(printf %q "$*")"
fi