2025-06-14 17:17:10 -05:00

26 lines
702 B
Bash
Executable File

#!/bin/sh
grim -g "$(slurp)" -o screenshot /tmp/screenshot.png || {
notify-send "Screenshot Failed" "Selection cancelled"
exit 1
}
response=$(curl -X POST \
-H "Authorization: Bearer simxnet" \
-F "file=@/tmp/screenshot.png;type=image/png" \
https://simxnet.andremor.eu.org:8080/upload) || {
notify-send "Upload Failed" "Could not connect to server"
exit 1
}
path=$(echo "$response" | sed -E 's/.*"(\/file\/[a-f0-9-]+)".*/\1/')
url="https://simxnet.andremor.eu.org:8080$path"
wl-copy "$url"
# works with dbus so check if you have it
notify-send "Screenshot Uploaded" "URL copied to clipboard!" --app-name="Chad Uploader" --icon=dialog-information
rm -f /tmp/screenshot.png