#!/usr/bin/env bash # File: shoot # Author: Yegor Bayev # Derived from http://sirupsen.com/static/misc/shoot by Sirupsen @ http://sirupsen.dk # # Description: Very simple script to make you # select a region of your screen, which will be captured, and # then uploaded. The URL will then be injected into your clipboard. # # Dependencies: curl, scrot, xclip, libnotify-bin # # License: # # Copyright 2013 Yegor Bayev # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see [http://www.gnu.org/licenses/]. CLIENT_ID="9657b96ca0b7f38" CMDLIST="scrot xclip curl" for e in $CMDLIST; do if [ -z "$(which $e)" ]; then echo "$e not installed, quit." exit 1 fi done SHOTPATH="$HOME/shot.png" function uploadImage { curl -H "Authorization: Client-ID $CLIENT_ID" -H "Expect: " -F "image=@$1" https://api.imgur.com/3/image | sed -E 's/.*"link":"([^"]+)".*/\1/' | sed "s|\\\\/|/|g" } if scrot -s $SHOTPATH; then LINK=$(uploadImage $SHOTPATH) echo $LINK | xclip -selection c rm $SHOTPATH notify-send -i go-down "Screenshot on $LINK" fi # shoot ends here