dotfiles/home/desktop/.local/bin/capture

43 lines
672 B
Plaintext
Raw Normal View History

2024-04-06 21:44:30 +02:00
#!/bin/sh
2024-04-14 08:31:41 +02:00
# v2.0
# Depends: herbe, imagemagick, xclip
2024-04-06 21:44:30 +02:00
2024-04-14 08:31:41 +02:00
ayuda() {
2024-04-06 21:44:30 +02:00
cat << EOF
Usage:
capture [-APVh]
Options:
2024-04-14 08:31:41 +02:00
-A: Save selected area to clipboard
-S: Save screen to clipboard
-W: Save active window to clipboard
-h: Show this help
2024-04-06 21:44:30 +02:00
EOF
}
case $1 in
2024-04-14 08:31:41 +02:00
-A)
import png:- | xclip -selection clipboard -t image/png
herbe 'Selected area to clipboard'
;;
-S)
import -window root png:- | xclip -selection clipboard -t image/png
herbe 'Screen to clipboard'
;;
-W)
import -window $(xdotool getwindowfocus) png:- | xclip -selection clipboard -t image/png
herbe 'Active window to clipboard'
;;
-h)
ayuda
;;
*)
printf "Invalid option!\n"
return
2024-04-06 21:44:30 +02:00
esac