Made selections optional--full screen is now the default.
parent
d829a6b5a5
commit
9aec432ba8
7
README
7
README
|
@ -6,3 +6,10 @@ On failure, it writes the curl output to /tmp/, where the image is also stored.
|
|||
No output is produced.
|
||||
|
||||
img depends on scrot, curl and xclip.
|
||||
You can use the following command to check dependencies:
|
||||
|
||||
for p in scrot curl xclip; do test $(command -v $p) && echo "Ok $p" || echo "No $p"; done
|
||||
|
||||
Recommended usage: Bind a key (such as PrtSc) to execute the script easily.
|
||||
Note: If you are using dwm, you will need to use the following patch for
|
||||
screen selections: http://dwm.suckless.org/patches/keypressrelease.
|
||||
|
|
5
img.sh
5
img.sh
|
@ -1,11 +1,12 @@
|
|||
#!/bin/bash
|
||||
# https://github.com/Ceryn/img
|
||||
# Call with '-s' to target only a selection of the screen.
|
||||
|
||||
clientid='3e7a4deb7ac67da'
|
||||
img=$(date '+/tmp/%N.png')
|
||||
|
||||
scrot -zs $img >/dev/null 2>&1 || exit
|
||||
scrot -z "$@" $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')
|
||||
echo $res | grep -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"
|
||||
|
|
Loading…
Reference in New Issue