dotfiles/bin/screenshot
Petar Kapriš 9d963b922a Add /bin
2025-12-16 21:42:18 +01:00

14 lines
1 KiB
Bash
Executable file

#!/bin/sh
# This is bound to Shift+PrintScreen by default, requires maim. It lets you
# choose the kind of screenshot to take, including copying the image or even
# highlighting an area to copy. scrotcucks on suicidewatch right now.
case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (copy)\\ncurrent window (copy)\\nfull screen (copy)" | bemenu -p "Screenshot which area?")" in
"a selected area") sleep 0.4 && import pic-selected-"$(date '+%y%m%d-%H%M-%S').png" ;;
"current window") sleep 0.4 && import -window "$(xdotool getactivewindow)" pic-window-"$(date '+%y%m%d-%H%M-%S').png" ;;
"full screen") sleep 0.4 && import -window root pic-full-"$(date '+%y%m%d-%H%M-%S').png" ;;
"a selected area (copy)") sleep 0.4 && import - | xclip -selection clipboard -t image/png ;;
"current window (copy)") sleep 0.4 && import -window "$(xdotool getactivewindow)" - | xclip -selection clipboard -t image/png ;;
"full screen (copy)") sleep 0.4 && import -window root - | xclip -selection clipboard -t image/png ;;
esac