key-handler (1173B)
#!/bin/bash
while read image
do
REALPATH="$(echo $PWD)/${image}"
BG_DIR="$HOME/.config/background"
if [[ "$1" == "b" ]]; then
mkdir -p "$BG_DIR" #just to make sure this dir always exists
cp "$image" "$BG_DIR/image.png" && feh --bg-scale "$BG_DIR/image.png" && notify-send -i "$BG_DIR/image.png" "Wallpaper changed..."
elif [[ "$1" == "c" ]]; then
if [[ -z "$DEST" ]]; then
DEST="$(cat $HOME/.config/custom/locations | dmenu -l 20 -i -p "Copy file(s) to where?" )"
fi
if [[ -z "$DEST" ]]; then
exit 0;
fi
cp "$image" "$DEST" && notify-send -i "$REALPATH" "$image has been copied to $DEST" &
elif [[ "$1" == "m" ]]; then
if [[ -z "$DEST" ]]; then
DEST="$(cat $HOME/.config/custom/locations | dmenu -l 20 -i -p "Move file(s) to where?" )"
fi
if [[ -z "$DEST" ]]; then
exit 0;
fi
mv "$image" "$DEST" && notify-send -i "$REALPATH" "$image has been moved to $DEST" &
elif [[ "$1" == "y" ]]; then
echo -n "$image" | xclip -selection clipboard && notify-send "$REALPATH copied to clipboard" &
fi
done