Files
saphidandClaude Opus 5.5 a7ae41b94f Verify against a real Frame; switch clipboard to Klipper
The headset desktop is nested Plasma in gamescope with no wl-copy/xclip,
so paste-to-frame.sh now calls Klipper over plasmashell's D-Bus bus.
connect.sh, push.sh, paste-to-frame.sh and install-apps.sh were exercised
on SteamOS 0.3.0 (build 20260922); docs record what was confirmed.
Cross-provider review skipped at Alex's request (Astra quota exhausted).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 19:35:16 +10:00

44 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env zsh
# Mac-side: put text on the Steam Frame desktop clipboard.
#
# Needs the headset's desktop (Plasma) to be running. Text only; very large
# pastes (over ~100 KB) exceed the argument limit, so use push.sh for those.
#
# Usage:
# scripts/paste-to-frame.sh # sends the Mac clipboard (pbpaste)
# some-cmd | scripts/paste-to-frame.sh -
set -euo pipefail
FRAME_ALIAS=${FRAME_ALIAS:-frame}
# Runs on the Frame. Clipboard text arrives on stdin.
# Verified 2026-09-25 (SteamOS 0.3.0 vr, build 20260922): the headset desktop is
# a nested Plasma Wayland session inside gamescope with its own D-Bus bus, and
# wl-copy/xclip are not installed. Klipper (org.kde.klipper, served by
# plasmashell) is reachable with qdbus6, so we borrow plasmashell's bus address.
remote=$(cat <<'EOF'
set -u
text=$(cat; printf x); text=${text%x}
pid=$(pgrep -u "$(id -u)" -x plasmashell | head -n 1)
if [ -z "$pid" ]; then
echo "plasmashell is not running: open the desktop in the headset first." >&2
exit 2
fi
bus=$(tr '\0' '\n' < "/proc/$pid/environ" | sed -n 's/^DBUS_SESSION_BUS_ADDRESS=//p')
if DBUS_SESSION_BUS_ADDRESS=$bus qdbus6 org.kde.klipper /klipper \
org.kde.klipper.klipper.setClipboardContents "$text" >/dev/null; then
echo "copied via Klipper (${#text} chars)"
else
echo "Klipper call failed (bus: ${bus:-none})" >&2
exit 2
fi
EOF
)
b64=$(print -rn -- "$remote" | base64)
if [[ "${1:-}" == "-" ]]; then
ssh "$FRAME_ALIAS" "bash -c \"\$(echo $b64 | base64 -d)\""
else
pbpaste | ssh "$FRAME_ALIAS" "bash -c \"\$(echo $b64 | base64 -d)\""
fi