Created
December 21, 2013 19:56
-
-
Save BinRoot/8074153 to your computer and use it in GitHub Desktop.
This script allows you the change the destination and name of your screenshots right after hitting printscreen. Bind your printscreen key to this script.
This file contains hidden or 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 | |
| # zshot allows you to easily change the filename and destination of each screenshot | |
| # Dependencies: scrot, zenity | |
| cd ~ | |
| if [ ! -d "Pictures" ] | |
| then mkdir ~/Pictures | |
| fi | |
| if [ "$1" == "--rename" ] | |
| then | |
| OLDFILE=$2 | |
| NEWFILE=`zenity --file-selection --title "Name the screenshot" --filename "$2" --save --confirm-overwrite --file-filter='*.png'` | |
| case $? in | |
| 0) | |
| echo "\"$NEWFILE\" selected." | |
| if [ "$NEWFILE" == "" ]; then | |
| rm ~/Pictures/$OLDFILE | |
| exit | |
| fi | |
| mv ~/Pictures/$OLDFILE $NEWFILE;; | |
| 1) | |
| echo "No file selected."; | |
| rm ~/Pictures/$OLDFILE;; | |
| -1) | |
| echo "An unexpected error has occurred."; | |
| rm ~/Pictures/$OLDFILE;; | |
| esac | |
| exit | |
| fi | |
| if [ "$1" == "--selection" ] | |
| then | |
| scrot -s '%Y-%m-%d-%s.png' -e 'sleep 2 & mv $f ~/Pictures/ & zshot.sh --rename $f' | |
| else | |
| scrot -d 0 '%Y-%m-%d-%s.png' -e 'sleep 2 & mv $f ~/Pictures/ & zshot.sh --rename $f' | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
excellent.