Last active
October 23, 2018 20:49
-
-
Save tsaavik/7103684 to your computer and use it in GitHub Desktop.
Automatically grabs a screenshot of a window after a short delay (default is 2 seconds),then copies it to /Dropbox/Public/share/Screenshots/hostname/and saves path to clipboard
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 | |
# sgrab - David Mcanulty 2013 | |
# | |
# Inspried by gist: https://gist.github.com/Saicheg/4231551 | |
# Automatically grabs a screenshot of a the currently active | |
# window after a short delay (default is 2 seconds), and | |
# then copies it to /Dropbox/Public/share/Screenshots/hostname/ | |
# and saves a tiny url encoded path to your system's clipboard | |
# | |
# You can use any scrot switch to override the defaults, like --select | |
# To select and area of a window instead of the entire window. | |
# | |
# Requires: | |
# curl | |
# Dropbox | |
# scrot | |
# xclip | |
################# | |
dirpath="${HOME}/Dropbox/Public/share/Screenshots/$HOSTNAME" | |
delay=2 | |
tstamp="$(date +%s)" | |
maketinyurl () { | |
url="$1" | |
curl --silent --output - "http://tinyurl.com/api-create.php?url=${url}" | |
} | |
mkdir -p "${dirpath}" | |
imagepath="${dirpath}/$tstamp.png" | |
if [[ -n $1 ]] ;then | |
scrot $@ "$imagepath" | |
else | |
scrot --delay ${delay} --focus "$imagepath" | |
fi | |
longurl=$(dropbox sharelink "$imagepath") | |
maketinyurl "${longurl}" | xclip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment