Add zipline/flameshot.sh
This commit is contained in:
parent
e100b8701d
commit
1ce349ec5c
1 changed files with 14 additions and 0 deletions
14
zipline/flameshot.sh
Normal file
14
zipline/flameshot.sh
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
flameshot gui -r > /tmp/ss.png
|
||||||
|
[ ! -s /tmp/ss.png ] && exit 1
|
||||||
|
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
trap 'rm -f "$temp_file"' EXIT
|
||||||
|
|
||||||
|
# Replace TOKEN and ZIPLINE_URL with your authorization token and the url to your Zipline instance before use, nothing else needs modified
|
||||||
|
if curl -sS -fH "authorization: TOKEN" https://ZIPLINE_URL/api/upload -F file=@/tmp/ss.png -H "Content-Type: multipart/form-data" >"$temp_file" 2>&1; then
|
||||||
|
jq -r '.files[0]' <"$temp_file" | tr -d '\n' | xsel -ib
|
||||||
|
notify-send -a "Flameshot" -u low -h "string:desktop-entry:org.flameshot.Flameshot" "Upload Successful" "Link copied to clipboard"
|
||||||
|
else
|
||||||
|
notify-send -a "Flameshot" -u critical -h "string:desktop-entry:org.flameshot.Flameshot" "Upload Failed" "$(<"$temp_file")"
|
||||||
|
fi
|
Loading…
Reference in a new issue