Last active
December 22, 2015 11:29
-
-
Save onjin/6466361 to your computer and use it in GitHub Desktop.
Command to get region screenshot and publish it on Dropbox
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 | |
# | |
# Gets screenshot using imagemagick import command | |
# puts it in Dropbox folder and returns dropbox url | |
# to screenshot | |
# Usage: dropshot [suffix] | |
# suffis - is optional, default 'dropshot' | |
# screenshots target directory | |
DEST_DIR=${HOME}/Dropbox/Public/dropshot | |
# screenshot type | |
# TODO: get it from args | |
EXT='jpg' | |
if [ -z $1 ]; then | |
SUFFIX='dropshot' | |
else | |
SUFFIX=$1 | |
fi | |
mkdir -p ${DEST_DIR} | |
SHOT_FILE="${DEST_DIR}/"`date +%Y%m%d%H%M%S`"_${SUFFIX}.${EXT}" | |
# imagemagick 'import' command | |
import ${SHOT_FILE} | |
# return dropbox public url to screenshot | |
if ! which xclip > /dev/null; then | |
echo `dropbox puburl ${SHOT_FILE}` | |
else | |
dropbox puburl ${SHOT_FILE} | xclip -sel clip | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment