858797a30c48bb7cd801bd4e4ef2006b74ebdb49
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/screenshots"
21 function take_screenshot
() {
22 FILENAME
="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1).png"
23 gnome-screenshot
-f "${LOCALPATH}/${FILENAME}" -p "$@"
24 scp
-q "${LOCALPATH}/${FILENAME}" "${REMOTEUSER}@${REMOTEHOST}:${REMOTEPATH}"
25 printf "${URLBASE}/${FILENAME}"|xclip
-selection p
26 printf "${URLBASE}/${FILENAME}"|xclip
-selection c
27 notify-send
-i applets-screenshooter
"screenshot.sh" "Screenshot published to ${URLBASE}/${FILENAME}"
30 function show_error
() {
31 errcho
"Please use one of: -w, --window, -a, --area, -s, --selection,"
32 errcho
" -f, --full or no argument at all."
38 take_screenshot
-w -b -e shadow
40 -a|
--area|
-s|
--selection)