Skip to content

Instantly share code, notes, and snippets.

@McKean
Created September 3, 2017 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save McKean/295af22d11abfdffeed6eea323f60681 to your computer and use it in GitHub Desktop.
Save McKean/295af22d11abfdffeed6eea323f60681 to your computer and use it in GitHub Desktop.
take screenshots and upload them to Dropbox with a share link
#! /bin/sh
# Run this and it will take a screenshot and upload it to dropbox
# scrot and dropbox_uploader need to be installed
shotsdir=$HOME/Pictures/screenshots
uploaddir=/Public/screenshots
filename="shot-`date +%Y-%m-%d-%H-%M-%S`.png"
file="$shotsdir/$filename"
case "$1" in
-d|$NULL)
scrot $* $file
;;
-w)
scrot -u $* $file
;;
-s)
notify-send 'select an area for the screenshot' &
scrot -s $* $file
;;
esac
dropbox_uploader upload $file $uploaddir
dropbox_uploader share $uploaddir/$filename | egrep -o 'https?://[^ ]+' | xclip -i -selection clipboard
notify-send "screenshot has been saved in $shotsdir and can be pasted"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment