123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #!/bin/sh
- DATE=$(date +'%Y/%m/%d')
- COUNT=1
- FILENAME=~/Pictures/Screenshots/${DATE}/${COUNT}.png
- mkdir -p "$(dirname "${FILENAME}")"
- until [[ ! -e $FILENAME ]]
- do
- FILENAME=~/Pictures/Screenshots/${DATE}/${COUNT}.png
- COUNT=$(( COUNT + 1 ))
- done
- TYPE=root
- while getopts rwsf:? opt
- do
- case "$opt" in
- r)
- TYPE=root
- ;;
- w)
- TYPE=window
- ;;
- s)
- TYPE=select
- ;;
- f)
- FILENAME="$OPTARG"
- ;;
- [?])
- echo "screenshot [ -? ] [ -r | -w | -s ] [ -f filename.png ]" >&2
- exit 1
- ;;
- esac
- done
- case $TYPE in
- root)
- scrot "${FILENAME}"
- ;;
- window)
- scrot -b -u "${FILENAME}"
- ;;
- select)
- scrot -s "${FILENAME}"
- ;;
- esac
|