nsxiv shortcuts changes

This commit is contained in:
tarneaux 2023-04-22 18:40:13 +02:00
parent 6736217a01
commit 990720180e
No known key found for this signature in database
GPG Key ID: 7459F84253DFA742
1 changed files with 19 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# Example for $XDG_CONFIG_HOME/nsxiv/exec/key-handler
# Called by nsxiv(1) after the external prefix key (C-x by default) is pressed.
@ -18,15 +18,21 @@
# If KEY has an uppercase equivalent, S-KEY is resolved into it. For instance,
# K replaces S-k and Scedilla replaces S-scedilla, but S-Delete is sent as-is.
print_to_file() {
while read line
echo "$line" | tee ./nsxiv-selected-files.txt -a
case "$1" in
"C-x") xclip -in -filter | tr '\n' ' ' | xclip -in -selection clipboard ;;
"C-p") print_to_file
# Multiple files might be passed into the handler. Loop over these
while read file; do
case "$1" in
# Copy the image path to the clipboard
xclip -in -filter | tr '\n' ' ' | xclip -in -selection clipboard ;;
# Print the selected images to STDOUT
echo "$line" ;;
# Rotate the selected image by 90 degrees. This can last a while for large images, so run it in the background
convert -rotate 90 "$file" "$file" ;;
# Rotate the other way
convert -rotate -90 "$file" "$file" ;;
# TODO: ability to edit RAW files