Created
March 12, 2017 23:22
-
-
Save circleous/73d80b4b1d9a81822bc4ea043d3317c3 to your computer and use it in GitHub Desktop.
Take screenshot with escrotum and upload it to safe.moe. Taken from https://aur.archlinux.org/packages/pscrotum/
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
#!/bin/sh | |
pomf() { | |
token="" | |
uppomf="https://safe.moe/api/upload" | |
if test $# -lt 1 ; then | |
echo "Usage: `basename $0` FILE [FILE...]" | |
exit 1 | |
fi | |
set= | |
for f ; do | |
test "$set" || set -- ; set=1 | |
set -- "$@" -F "files[]=@$f" | |
done | |
curl -fsSL "$@" "$uppomf" -H "token: $token" | jq -c -r '.files[].url' | |
} | |
ARGS=$1 | |
if [ `echo $ARGS | grep h` ]; then | |
echo "Usage: pscrotum [hsfd]" | |
echo "-h: Shows this help screen" | |
echo "-s: Screenshot a selected region" | |
echo "-f: Screenshot focused window" | |
echo "-d: Delete image from local storage after uploaded" | |
echo "ex: pscrotum sd <--Screenshot selection and delete after upload" | |
exit | |
fi | |
fn=`date | sed -e 's/ /-/g' | sed -e 's/:/\./g'`.png | |
if [ `echo $ARGS | grep s` ]; then | |
escrotum -s "$fn" && pomf $fn | xclip -sel c; mv -v $fn ~/Pictures/ | |
elif [ `echo $ARGS | grep f` ]; then | |
escrotum -u "$fn" && pomf "$fn" | xclip -sel c; mv -v $fn ~/Pictures/ | |
else | |
escrotum "$fn" && pomf "$fn" | xclip -sel c; mv -v $fn ~/Pictures/ | |
fi | |
if [ `echo $ARGS | grep d` ]; then | |
rm -vf ~/Pictures/$fn | |
fi | |
notify-send -i "Screenshot captured and link copied to clipboard!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment