1234567891011121314151617181920 |
- #!/bin/sh
- directory="$HOME/pictures/screenshots/$(date +%Y)/$(date +%m)"
- filename="$directory/$(date +%d-%H%M%S).png"
- command="import -window root $filename"
- for arg; do
- case $arg in
- -s) command="import -window root -crop $(slop -f %g) $filename" ;;
- -w) command="import -window $(xdotool getmouselocation --shell | sed -n 's/WINDOW=//gp') $filename" ;;
- -u) upload=true ;;
- esac
- done
- mkdir -p $directory
- eval $command
- if [ "$upload" = true ]; then
- url="$(curl -sL -F files[]=@$filename https://file0.s3kr.it/upload | sed -n 's@.*https*://file0.s3kr.it/@https://file0.s3kr.it/@;s@'\'')">@@p')"
- printf "$url" | xsel -bpsi
- exiftool -overwrite_original -url=$url $filename
- notify-send "Screenshot succesful." "$filename -> $url." -i "$filename"
- fi
|