Files
scrot/cli/scrot-clip-push
Fredrik Johansson 4eee44f675 Initial scaffold: blob store server, CLI scripts, and PWA share target
Clipboard/screenshot sync across own devices via a single DEVICE_TOKEN-gated
blob store, plus a small installable web app so a phone can push/pull
clips and share screenshots via the OS share sheet.
2026-08-20 15:28:42 +02:00

22 lines
568 B
Bash
Executable File

#!/usr/bin/env bash
# Reads the system clipboard and pushes it to scrot as a `clip` blob.
set -euo pipefail
: "${SCROT_SERVER:?set SCROT_SERVER, e.g. https://scrot.example.com}"
: "${DEVICE_TOKEN:?set DEVICE_TOKEN}"
if [ -n "${WAYLAND_DISPLAY:-}" ]; then
content=$(wl-paste --no-newline)
else
content=$(xclip -selection clipboard -o)
fi
curl -sf -X POST "$SCROT_SERVER/api/blobs" \
-H "X-Device-Token: $DEVICE_TOKEN" \
-H "X-Blob-Kind: clip" \
-H "Content-Type: text/plain; charset=utf-8" \
--data-binary "$content" \
-o /dev/null
echo "clip pushed"