dmenu-scripts/dmenu-screenshot
2023-08-23 19:50:09 +02:00

26 lines
620 B
Bash
Executable File

#!/bin/sh
# It lets you choose the kind of screenshot to take, including
# copying the image or even highlighting an area to copy.
load_config () {
. $HOME/.config/dmenu/config
}
menu () {
case "$(printf "a selected area\\nfull screen" | $DMENU -l 6 -p "Screenshot which area?")" in
"a selected area") sleep 0.5; maim -m 2 -s $dir/pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
"full screen") sleep 0.5; maim -m 2 $dir/pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
esac
}
main () {
dir="$HOME/pics/screenshots"
[ ! -d "$dir" ] && mkdir $dir -p
load_config
menu
}
main $@