fxde-core/scripts/posix/hunter

51 lines
1.2 KiB
Plaintext
Executable File

# Hunter is a simple tool that will take a screenshot of a specific window
# using existing tools on the system, ordered from most to least efficient.
# For now I only know how to implement this with scrot... import soon:tm:!
# How to check for our tools.
csearch()
if [ -x /usr/bin/scrot ]
then export cap=scrot
elif [ -x /usr/bin/import
then export cap=import
fi
vsearch()
if [ -x /usr/bin/feh ]
then export view=feh
elif [ -x /usr/bin/gpicview ]
then export view=gpicview
fi
# Gather our tools.
csearch
vsearch
case "$1" in
-g)
if [ $cap = scrot ]
then exec $cap -d 1 -e "exec $view /tmp/$f" /tmp/scrot.png
fi
;;
-s)
if [ $cap = scrot ]
then exec $cap -n -d 1 -u -e "exec $view /tmp/$f" /tmp/scrot.png
fi
;;
-t)
printf "$cap\n"
printf "$view\n"
;;
*)
printf "Hunter is a tool to take both window specific and non-specific screenshots using pre-existing utilities. Hunter accepts the following options:\n\n -g: Shoot the entire screen.\n -s: Shoot a specific window.\n -t: Print the tools Hunter is using.\n"
;;
esac