1
0
Fork 0
dotfiles/.local/bin/dmenuflameshot

25 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# this script provides a menu of screenshot options, using flameshot
geom() {
case $1 in
"active") eval "$(xdotool getactivewindow getwindowgeometry --shell)" ;;
"select") eval "$(xdotool selectwindow getwindowgeometry --shell)" ;;
esac
echo "${WIDTH}x${HEIGHT}+${X}+${Y}"
}
# variables
2023-03-13 01:35:23 +01:00
output="${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots/$(date '+%y%m%d-%H%M-%S').png"
case "$(printf "selected area\\ncurrent window\\nselected window\\nfull screen\\nselected area (copy)\\ncurrent window (copy)\\nselect window (copy)\\nfull screen (copy)" | dmenu -i -p "Screenshot which area?")" in
"selected area") flameshot gui -p "$output" ;;
"current window") flameshot gui -p "$output" --region "$(geom active)";;
"selected window") flameshot gui -p "$output" --region "$(geom select)";;
"full screen") flameshot full -p "$output" ;;
"selected area (copy)") flameshot gui -c ;;
"current window (copy)") flameshot gui -p "$output" -c --region "$(geom active)";;
"selected window (copy)") flameshot gui -p "$output" -c --region "$(geom select)";;
"full screen (copy)") flameshot full -c ;;
esac