Create a gist now

Instantly share code, notes, and snippets.

Poor man's GtkGrab :P
#!/bin/bash
# based on GtkGrab by @EvanDotPro https://github.com/EvanDotPro/GtkGrab
function rename_file()
{
NEWFILE=$(echo $1 | md5sum | cut -c-5)'.png'
}
DOMAIN=http://i.domain.tld/
LOCALPATH=/home/user/Pictures/screenshots/
xfce4-screenshooter -r --save=$LOCALPATH
LOCALFILE=$(ls -tr $LOCALPATH | tail -n 1)
rename_file $LOCALFILE
I=0
LIMIT=10
while [ "$I" -lt "$LIMIT" -a -f "$LOCALPATH$NEWFILE" ]
do
rename_file $NEWFILE
I=`expr $I + 1`
done
mv "$LOCALPATH$LOCALFILE" "$LOCALPATH$NEWFILE"
scp "$LOCALPATH$NEWFILE" user@domain.tld:/home/user/screens/$NEWFILE
echo "$DOMAIN$NEWFILE" | xclip -selection clipboard
notify-send "Screenshot uploaded, URL in clipboard"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment