Last active
August 31, 2016 16:33
-
-
Save Cewlt/ad6314ed7e3800d6db50 to your computer and use it in GitHub Desktop.
bash screenshot script using imgur api, appended with key shortcut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clientid='<insert imgur client id here>' | |
img=$(mktemp '/tmp/img-XXXXXX.png') | |
gnome-screenshot -a -f $img >/dev/null 2>&1 || exit | |
res=$(curl -sH "Authorization: Client-ID $clientid" -F "image=@$img" "https://api.imgur.com/3/upload") | |
echo $res | grep -qo '"status":200' && link=$(echo $res | sed -e 's/.*"link":"\([^"]*\).*/\1/' -e 's/\\//g') | |
test -n "$link" && (x-www-browser $link && rm "$img") || echo "$res" > "$img.error" | |
notify-send "screenshot successful!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment