dotfiles/home/default/.local/bin/screenshot.sh

36 lines
677 B
Bash
Raw Normal View History

2023-07-02 05:41:21 -04:00
#!/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
update-recentf.py $file
2023-07-02 05:41:21 -04:00
exit 0
else
echo "screenshot failed."
exit 1
fi