Skip to content

Instantly share code, notes, and snippets.

@naelstrof
Created January 16, 2016 00:41
Show Gist options
  • Save naelstrof/ee22fd66df9218274c39 to your computer and use it in GitHub Desktop.
Save naelstrof/ee22fd66df9218274c39 to your computer and use it in GitHub Desktop.
Imgur screenshooter
#!/bin/bash
if [ -d "~/Pictures" ]; then
mkdir -p ~/Pictures
fi
TIME=$(date +"%s")
maim -s --opengl --shader=hippie -n ~/Pictures/${TIME}.png
if [ $? == 1 ]; then
if [ -f /usr/share/sounds/freedesktop/stereo/dialog-error.oga ]; then
cvlc /usr/share/sounds/freedesktop/stereo/dialog-error.oga -q --play-and-exit
fi
echo "Failed to create screenshot!" | xclip -selection clip-board
exit 1
fi
LINK=$(imgur --anon upload ~/Pictures/${TIME}.png | awk '/^original/ {print $2}')
if [ -z ${LINK// } ]; then
if [ -f /usr/share/sounds/freedesktop/stereo/dialog-error.oga ]; then
cvlc /usr/share/sounds/freedesktop/stereo/dialog-error.oga -q --play-and-exit
fi
echo "Failed to upload screenshot!" | xclip -selection clip-board
exit 1
fi
echo $LINK | xclip -selection clip-board
if [ -f /usr/share/sounds/freedesktop/stereo/screen-capture.oga ]; then
cvlc /usr/share/sounds/freedesktop/stereo/screen-capture.oga -q --play-and-exit
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment