Made scripts more readable by moving most logic to functions.
This commit is contained in:
parent
86e3a3a79c
commit
5c738fdc77
11 changed files with 234 additions and 133 deletions
|
@ -2,13 +2,24 @@
|
|||
|
||||
# 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
|
||||
}
|
||||
|
||||
. $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; shotgun -g $(hacksaw) $dir/pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
|
||||
"full screen") sleep 0.5; shotgun $dir/pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
dir="$HOME/pics/screenshots"
|
||||
[ ! -d "$dir" ] && mkdir $dir -p
|
||||
main () {
|
||||
dir="$HOME/pics/screenshots"
|
||||
[ ! -d "$dir" ] && mkdir $dir -p
|
||||
|
||||
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | $DMENU -l 6 -p "Screenshot which area?")" in
|
||||
"a selected area") sleep 0.5; shotgun -g $(hacksaw) $dir/pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
|
||||
"full screen") sleep 0.5; shotgun $dir/pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
|
||||
esac
|
||||
load_config
|
||||
|
||||
menu
|
||||
}
|
||||
|
||||
main $@
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue