35 lines
651 B
Bash
35 lines
651 B
Bash
|
#!/bin/sh
|
||
|
[ -z "$1" ] && printf "Usage: screenshot.sh [output|active|window] \n" && exit 0
|
||
|
|
||
|
file=$HOME/Pictures/Screenshots/$(date +'%Y-%m-%d_%H.%M.%S_%Z').png
|
||
|
|
||
|
if [[ -n "$1" ]]; then
|
||
|
case "$1" in
|
||
|
output) grimshot save output $file
|
||
|
break
|
||
|
;;
|
||
|
active) grimshot save active $file
|
||
|
break
|
||
|
;;
|
||
|
window) grimshot save window $file
|
||
|
break
|
||
|
;;
|
||
|
screen) grimshot save screen $file
|
||
|
break
|
||
|
;;
|
||
|
*)
|
||
|
echo $@ is not an argument
|
||
|
break
|
||
|
;;
|
||
|
esac
|
||
|
fi
|
||
|
|
||
|
if [[ -N $file ]]; then
|
||
|
echo "screenshot saved."
|
||
|
notify-send "screenshot saved." -i $file
|
||
|
exit 0
|
||
|
else
|
||
|
echo "screenshot failed."
|
||
|
exit 1
|
||
|
fi
|