Hello, world.

master
Ceryn 2014-02-14 00:13:19 +01:00
commit 193a53fdbc
2 changed files with 14 additions and 0 deletions

5
README Normal file
View File

@ -0,0 +1,5 @@
img : Minimalistic screenshot uploader for Linux
img is a minimalistic bash script that uploads a screen selection to imgur. On success, it copies the image link to the clipboard and sounds a bell. On failure, it writes the curl output to /tmp/, where the image is also stored.
img depends on scrot and xclip.

9
img.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
clientid='3e7a4deb7ac67da'
img=$(date '+/tmp/%N.png')
scrot -zs $img >/dev/null 2>&1 || exit
res=$(curl -sH "Authorization: Client-ID $clientid" -F "image=@$img" "https://api.imgur.com/3/upload")
echo $res | egrep -qo '"status":200' && link=$(echo $res | sed -e 's/.*"link":"\([^"]*\).*/\1/' -e 's/\\//g')
test -n "$link" && (printf $link | xclip; printf "\a") || echo "$res" > "$img.error"