Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # This script is made by Tomi Leppänen aka Tomin (http://tomin.dy.fi/)
- # You are free to use, copy, redistribute and modify this script
- # as long as you accept that ***I won't take any responsibility
- # for this code and it comes without any warranty***
- # This script takes a screenshot from the part of screen that you can
- # select by mouse and then it saves the screenshot to your Dropbox
- # folder and then pastes a public link to clipboard.
- # It is recommended to add this as a hotkey to your DE
- # Configuration:
- # Date format
- DATE=`date +%Y-%m-%d-%H-%M-%S`
- # Directory to save images
- DIRECTORY="$HOME/Dropbox/Public/Scrot"
- # Clipboard to use, values: 'clipboard' for keyboard,
- # and 'primary' for mouse-middle-click
- # or 'both' for both of them
- CLIPBOARD='primary'
- # Check depenciens
- if [ -z `which scrot` 2> /dev/null ]
- then echo "Scrot is requred! Install scrot"
- exit
- fi
- if [ -z `which xclip` 2> /dev/null ]
- then echo "Xclip is required! Install xclip"
- exit
- fi
- if [ -z `which dropbox` 2> /dev/null ]
- then echo "Dropbox is required! Install dropbox"
- exit
- fi
- # The code
- URL_PREFIX="http://dl.dropbox.com/u/$USERID/$DIRECTORY"
- scrot -s "$DIRECTORY/$DATE.png"
- PUBURL=$(dropbox puburl "$DIRECTORY/$DATE.png" |tr -d "\n")
- if [ $CLIPBOARD == "both" ]; then
- echo -n "$PUBURL" |xclip -selection clipboard
- echo -n "$PUBURL" |xclip -selection primary
- else
- echo -n "$PUBURL" |xclip -selection $CLIPBOARD
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement