bin/screenshot (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#!/bin/sh
#
# Takes a screenshot with grimshot, in clipboard or in given directory
#
MODE=$(printf "save\ncopy" | dmenu)
# If dmenu was cancelled, exit program
if [ $? -ne 0 ]; then
exit 1
fi
case "$MODE" in
*save*)
cd $HOME/downloads/screenshots
# while true; do
# selected_dir=$(ls | dmenu -i)
# if [ -z "$selected_dir" ]; then
# exit 0
# fi
#
# if [ -d "$selected_dir" ]; then
# cd "$selected_dir"
# continue
# fi
#
# if [ -e "$selected_dir" ]; then
# notify-send "Error: File exists!"
# exit 0
# fi
#
# break
# done
# grimshot save area "$PWD/$selected_dir.png" && notify-send "$PWD/$selected_dir.png" "saved"
timestamp=$(date +"%Y-%m-%d_%H-%M-%S")
grimshot save area "$timestamp.png" && notify-send "$timestamp.png" "saved"
;;
*copy*)
grimshot copy area && notify-send "Screenshot copied"
;;
esac
|