Created
August 28, 2012 23:11
-
-
Save senko/3505177 to your computer and use it in GitHub Desktop.
Grab a screenshot and paste it to the Web
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# screen-paste - Paste a screenshot to the Web | |
# | |
# Written by Senko Rasic <[email protected]> | |
# Released into Public Domain. Use it as you like. | |
# | |
# The tool allows the user to select a portion of the screen, then copies it | |
# to S3, and stores the resulting URL in clipboard. | |
# | |
# Requirements: uuidgen, scrot, s3cmd, xclip, mplayer (optional) | |
S3_DESTINATION="s3://dobarkod.hr-test/screenshots/" | |
SHUTTER_SOUND="/usr/share/sounds/freedesktop/stereo/camera-shutter.oga" | |
set -ex | |
fname="/tmp/$(uuidgen).png" | |
test -f "$fname" && rm -f "$fname" | |
scrot -z -s "$fname" | |
s3cmd put -P --no-progress "$fname" "$S3_DESTINATION" | \ | |
grep '^Public URL' | \ | |
sed s'/.*: //' | \ | |
xclip -i -selection "clipboard" | |
rm -f "$fname" | |
if $(which mplayer) && test -f "$SHUTTER_SOUND"; then | |
mplayer -really-quiet "$SHUTTER_SOUND" >/dev/null 2>&1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment