mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 08:00:32 +02:00
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>
This commit is contained in:
1 parent
1f6115b789
commit
a7ae41b94f
8 files changed
+78
-48
No files matched your search
+19
-20
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env zsh
|
||||
# Mac-side: put text on the Steam Frame desktop clipboard.
|
||||
#
|
||||
# UNTESTED against real hardware. Assumes the in-headset desktop is a Plasma
|
||||
# session owned by the SSH user; prints diagnostics if that assumption fails.
|
||||
# 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)
|
||||
@@ -11,28 +11,27 @@ set -euo pipefail
|
||||
|
||||
FRAME_ALIAS=${FRAME_ALIAS:-frame}
|
||||
|
||||
# Runs on the Frame. Clipboard text arrives on stdin. setsid keeps the
|
||||
# clipboard-serving process alive after the SSH session closes.
|
||||
# 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
|
||||
tmp=$(mktemp)
|
||||
cat > "$tmp"
|
||||
rt=/run/user/$(id -u)
|
||||
sock=$(ls "$rt" 2>/dev/null | grep -E '^wayland-[0-9]+$' | head -n 1)
|
||||
if [ -n "$sock" ] && command -v wl-copy >/dev/null 2>&1 \
|
||||
&& XDG_RUNTIME_DIR=$rt WAYLAND_DISPLAY=$sock setsid wl-copy < "$tmp" >/dev/null 2>&1; then
|
||||
echo "copied via wl-copy ($sock)"
|
||||
elif command -v xclip >/dev/null 2>&1 \
|
||||
&& DISPLAY=:0 setsid xclip -selection clipboard -i < "$tmp" >/dev/null 2>&1; then
|
||||
echo "copied via xclip (DISPLAY=:0)"
|
||||
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 "clipboard copy failed; diagnostics:" >&2
|
||||
echo " runtime dir: $(ls "$rt" 2>&1 | tr '\n' ' ')" >&2
|
||||
echo " wl-copy: $(command -v wl-copy || echo missing) xclip: $(command -v xclip || echo missing)" >&2
|
||||
loginctl list-sessions --no-legend 2>&1 | sed 's/^/ session: /' >&2
|
||||
rm -f "$tmp"; exit 2
|
||||
echo "Klipper call failed (bus: ${bus:-none})" >&2
|
||||
exit 2
|
||||
fi
|
||||
rm -f "$tmp"
|
||||
EOF
|
||||
)
|
||||
b64=$(print -rn -- "$remote" | base64)
|
||||
|
||||
Reference in new issue
Block a user