nixos-config/users/home-manager/foo-dogsquared/config/sxiv/exec/key-handler
Gabriel Arazas 3a022a374a Restructure the modules
I think this is better for separating modules explicitly. This is also
considered as there are similar objects between modules (e.g., NixOS
and home-manager modules and users).

Revert users module to old position
2021-12-06 17:03:39 +08:00

41 lines
1.3 KiB
Bash
Executable File

#!/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