2 # A quick and dirty script to take a screenshot, upload it via scp
3 # and put a link to it in the clipboard for easy pasting to i.e. IRC.
4 # It assumes a lot of things, e.g. that ssh to the target host has
5 # been set up with a working private key, and that xclip and
6 # gnome-screenshot is installed.
8 # If all you have is a hammer, everything looks like a nail.
12 RemoteHost
="wowbagger.slaskete.net"
13 RemotePath
="/var/www/eina.rjh.im/screenshots/"
14 LocalPath
="${HOME}/ownCloud/Screenshots/"
15 UrlBase
="https://eina.rjh.im/g"
21 function take_screenshot
() {
22 FileName
="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 6 | head -n 1).png"
23 if [ "$@" = "clipboard" ]; then
24 xclip
-out -selection clipboard
-t image
/png
> "${LocalPath}/${FileName}" 2>/dev
/null
26 gnome
-screenshot -f "${LocalPath}/${FileName}" -p "$@"
28 if [ -f "${LocalPath}/${FileName}" ]; then
29 scp
-q "${LocalPath}/${FileName}" "${RemoteUser}@${RemoteHost}:${RemotePath}"
30 echo -n "${UrlBase}/${FileName}"|xclip
-selection p
31 echo -n "${UrlBase}/${FileName}"|xclip
-selection c
32 notify
-send -i applets
-screenshooter "screenshot.sh" "Screenshot published to ${UrlBase}/${FileName}"
36 function show_error
() {
37 errcho
"Please use one of: -w, --window, -a, --area, -s, --selection,"
38 errcho
" -f, --full or no argument at all."
44 take_screenshot
-w -b -e shadow
46 -a|--area|-s|--selection)
53 -c|--clipboard|-p|--paste)
54 take_screenshot clipboard