[code]
Your code here.
______________________
/ You see me because I \
\ use monospace font. /
----------------------
\ ,__,
\ (oo)____
(__) )\
||--|| *
[/code]
#!/bin/bash
#
# Original "shoot" script header below, however the script was largely edited by DrSlony.
#
# 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:
#
# Imgur Bash Upload Script (http://imgur.com/tools/imgurbash.sh)
# Comment: Must be in path (see below) with the name "imgur" (not imgur.sh)
#
# Scrot
# Comment: Scrot is what takes the actual screenshot.
#
# Xclip
# Comment: Xclip is what makes the script able to inject the direct url
# into your clipboard.
#
# libnotify*
# Comment: Will notify you whenever the direct URL is in the clipboard
#
# Installation:
#
# Move the file to a local bin. And put the path of this bin, into
# your path. (See: www.troubleshooters.com/linux/prepostpath.htm)
#
# From then on, you can either activate it via your terminal, or via
# your window manager or similar, so you can bind it to a keycombination.
#
function uploadImage {
curl -s -F "image=@$1" -F "key=486690f872c678126a2c09a9e196ce1b" http://imgur.com/api/upload.xml | grep -E -o "<original_image>(.)*</original_image>" | grep -E -o "http://i.imgur.com/[^<]*"
}
hash notify-send 2>&- || { echo "notify-send not found, install libnotify first" >&2; exit 1; }
hash scrot 2>&- || { notify-send "ERROR" "scrot not found, install scrot first" >&2; exit 1; }
hash xclip 2>&- || { notify-send "ERROR" "xclip not found, install xclip first" >&2; exit 1; }
hash curl 2>&- || { notify-send "ERROR" "curl not found, install curl first" >&2; exit 1; }
cd /tmp/ || { notify-send "ERROR" "Could not enter /tmp, set a different temp dir in the script" >&2; exit 1; }
filename="scrot_`date +%F\ %H%M%S`.png"
scrot -bs "${filename}"
notify-send "Uploading" "Uploading screenshot\n${filename}"
exec 3>&1 4>&2 ; duration="$( { TIMEFORMAT="%0R"; time uploadImage "${filename}" | xclip -selection c 1>&3 2>&4; } 2>&1 )" ; exec 3>&- 4>&- # http://mywiki.wooledge.org/BashFAQ/032
rm "${filename}"
notify-send "Done" "Uploaded\n${filename}\nin ${duration} seconds."
Users browsing this forum: No registered users and 1 guest