dotfiles/sxiv/exec/key-handler
foo-dogsquared d3fadf8fe1 Finalize the setup for the dotfiles
The documentation for it has been updated, wal templates are also updated, and certain scripts has been revised to be easily understood.

This may be my stop for the whole year. I'm pretty content with this one.
2020-05-01 21:32:25 +08:00

41 lines
1.3 KiB
Bash

#!/bin/sh
# The keyboard shortcuts (prepended with <C-x>).
while read file
do
case "$1" in
# Prompt and delete the file.
"d")
[ "$(printf 'No\nYes' | rofi -dmenu -p 'Delete all of the selected image(s)?')" = "Yes" ] && rm "$file" && notify-send "$file deleted" ;;
# Rotate 90 degrees.
"r")
convert -rotate 90 "$file" "$file" ;;
# Rotate -90 degrees.
"R")
convert -rotate -90 "$file" "$file" ;;
# Copy the path of the image (relative to the present working directory).
"y")
echo -n "$file" | xclip -selection clipboard && notify-send "'$file' name copied to clipboard" ;;
# Copy the absolute path of the image.
"Y")
readlink --canonicalize "$file" | xclip -selection clipboard && notify-send "Absolute path of '$file' copied to clipboard" ;;
"i")
feh --bg-fill "$file" ;;
# Activate Pywal to the selected image.
"w")
rofi -dmenu -p "Add some arguments for executing pywal? ('wal -i \$file') " | xargs wal -i "$file" ;;
# Activate `select-theme` script which is basically pywal with additional things.
"C-w")
select-theme "$file" ;;
esac
done