dotfiles/sxiv/exec/key-handler
Gabriel Arazas 0681d1fd7c Structure the project with NixOS-styled distros
It's been a while but I've been using NixOS (or anything styled like it
like GuixSD, for example) and distro-hopped from Arch Linux.
I think it's high noon for making the structure of this setup to be
truer to one of the big objectives which is how easy to transfer this
between different setups.
Which means I removed some things such as the package lists, systemd
config files, and package manager-specific configs.
While the solution is easy (which is to simply ignore the
system-specific files) but I'm not going with the pragmatic solution not
because I'm a dumbass but because I'm so smart that I want to create a
challenge for myself to solve a puzzle on figuring out a way on how to
structure my dotfiles. :)

Such a productive use of my time, that's for sure.
2020-09-11 03:12:26 +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