dotfiles
shell, editor, ssh.
git clone https://owenrusk.dev/dotfiles.git
commit 6f2343e33b26e807c323d3ddb7805769654aefcc parent 970b88c7d6f974b5db5e312ea6199f13c74c8652 author Owen Rusk <owen@papermothgames.com> date 2025-06-10 15:45:38 -0500
clip: osc 52 when there's no clipboard but there is ssh
| bin/clip | +4 | -0 |
diff --git a/bin/clip b/bin/clip
index 1bf7968..5363e06 100755
--- a/bin/clip
+++ b/bin/clip
@@ -4,6 +4,10 @@ if [ -n "${WAYLAND_DISPLAY:-}" ] && command -v wl-copy >/dev/null 2>&1; then
exec wl-copy
elif [ -n "${DISPLAY:-}" ] && command -v xclip >/dev/null 2>&1; then
exec xclip -selection clipboard
+elif [ -n "${SSH_TTY:-}" ]; then
+ # osc 52: the terminal at the other end does the copying
+ printf '\033]52;c;%s\a' "$(base64 | tr -d '\n')" > "$SSH_TTY"
+ exit 0
fi
echo "clip: no clipboard here" >&2
exit 1