1234567891011121314151617181920212223242526272829303132333435363738 |
- #!/bin/sh
- DATE=(`date +%F`)
- COUNT=0
- FILENAME=~/Pictures/snapshot-${DATE}-${COUNT}.png
- until [[ ! -e $FILENAME ]]
- do
- FILENAME=~/Pictures/snapshot-${DATE}-${COUNT}.png
- COUNT=`expr ${COUNT} + 1`
- done
- TYPE=root
- while getopts rwf:? opt
- do
- case "$opt" in
- r)
- TYPE=root
- ;;
- w)
- TYPE=window
- ;;
- f)
- FILENAME="$OPTARG"
- ;;
- [?])
- echo "i3-snapshot [ -? ] [ -r | -w ] [ -f filename.png ]" >&2
- exit 1
- ;;
- esac
- done
- if [[ $TYPE == "root" ]] ; then
- import -window root ${FILENAME}
- else
- import ${FILENAME}
- fi
|