update screenshot to be fancy

This commit is contained in:
2026-01-08 03:47:02 -03:00
parent 28643cd8a8
commit 03a85c3b29
2 changed files with 31 additions and 1 deletions

28
scripts/screenshot-upload.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e
set -a
source ~/.config/imgshare.env
set +a
TOKEN="${IMGSHARE_TOKEN:?IMGSHARE_TOKEN not set}"
ENDPOINT="https://share.caio.wakamatsu.cc/upload"
tmp=$(mktemp --suffix=.png)
grim -g "$(slurp)" "$tmp"
swappy -f "$tmp" -o "$tmp"
resp=$(curl -s "$ENDPOINT" \
-H "Authorization: Bearer $TOKEN" \
-F "file=@$tmp")
url=$(echo "$resp" | jq -r '.url // empty')
if [[ -n "$url" ]]; then
echo "https://share.caio.wakamatsu.cc$url" | wl-copy
notify-send "Uploaded Image"
fi
rm "$tmp"