#!/bin/sh
while read file ; do
fullpath="$(pwd)/$file"
case "$1" in
"b") setbg "$file" ;;
"r") convert -rotate 90 "$file" "$file" ;;
"R") convert -rotate -90 "$file" "$file" ;;
"t") convert "$file" -transparent white "$file" ;;
"i") convert "$file" -negate "$file" ;;
"f") convert -flop "$file" "$file" ;;
"y") echo -n "$file" | xclip -selection clipboard &&
notify-send -i "$file" "$file copied to clipboard" ;;
"Y") echo -n "$fullpath" | xclip -selection clipboard &&
notify-send -i "$file" "$fullpath copied to clipboard" ;;
"d") [ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] &&
rm "$file" && notify-send "$file deleted." ;;
"G") $(ifinstalled gimp) && gimp "$file" ;;
esac
done