Last active
June 15, 2017 00:29
-
-
Save sammy8806/3f8f3abb69db0c024ce69d628e94e9f9 to your computer and use it in GitHub Desktop.
Screenshot-Clip uploading based on xfce4-screenshooter, xclip and notify-send
This file contains hidden or 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
USERNAME="" | |
PASSWORD="" | |
URL="https://scr.2linux.de/upload.php" |
This file contains hidden or 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/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" |
This file contains hidden or 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/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