Skip to content

Instantly share code, notes, and snippets.

@sammy8806
Last active June 15, 2017 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sammy8806/3f8f3abb69db0c024ce69d628e94e9f9 to your computer and use it in GitHub Desktop.
Save sammy8806/3f8f3abb69db0c024ce69d628e94e9f9 to your computer and use it in GitHub Desktop.
Screenshot-Clip uploading based on xfce4-screenshooter, xclip and notify-send
USERNAME=""
PASSWORD=""
URL="https://scr.2linux.de/upload.php"
#!/bin/bash
FILE=$1
function msg() {
echo "[$1] $2"
notify-send -t 3000 -a "Screen Shooter" "$1" "$2"
}
function error() {
msg "Screenshoot error!" "$1"
exit;
}
type curl > /dev/null 2>&1 || {
error "Cannot find CURL in path"
}
type xclip > /dev/null 2>&1 || {
error "Cannot find xclip in path"
}
if [ "$#" -lt 1 ]; then
error "Please give a filename"
fi
if [ ! -f ~/.scrshootrc ]; then
error "Please provide ~/.scrshootrc"
fi
source ~/.scrshootrc
LINK=$(curl -s -F"username=${USERNAME}" -F"password=${PASSWORD}" -F"file=@${FILE}" "${URL}")
if [ -z "$LINK" ]; then
msg 'Upload failed!' 'Cannot upload file, please try again in a moment'
fi
echo "Link: $LINK"
echo "$LINK" | tr -d '\n' | xclip -selection c
msg "Screenshot upload success" "Link has been copied to your clipboard"
#!/bin/bash
xfce4-screenshooter -r -o "$HOME/bin/imageupload"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment