1
0
Fork 0

example nsxiv configs

This commit is contained in:
Luca Bilke 2024-02-28 18:11:59 +01:00
parent c629631e3d
commit 019042aa4f
4 changed files with 54 additions and 0 deletions

11
.config/nsxiv/exec/image-info Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
s=" " # field separator
exec 2>/dev/null
filename=$(basename -- "$1")
filesize=$(du -Hh -- "$1" | cut -f 1)
geometry="${2}x${3}"
echo "${filesize}${s}${geometry}${s}${filename}"

21
.config/nsxiv/exec/key-handler Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
# shellcheck disable=2162
rotate() {
degree="$1"
tr '\n' '\0' | xargs -0 realpath | sort | uniq | while read file; do
case "$(file -b -i "$file")" in
image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
*) mogrify -rotate "$degree" "$file" ;;
esac
done
}
case "$1" in
"C-x") xclip -in -filter | tr '\n' ' ' | xclip -in -selection clipboard ;;
"C-c") while read file; do xclip -selection clipboard -target image/png "$file"; done ;;
"C-g") tr '\n' '\0' | xargs -0 gimp & ;;
"C-comma") rotate 270 ;;
"C-period") rotate 90 ;;
"C-slash") rotate 180 ;;
esac

11
.config/nsxiv/exec/thumb-info Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
s=" " # field separator
exec 2>/dev/null
filename=$(basename -- "$4")
filesize=$(du -Hh -- "$4" | cut -f 1)
echo "${filesize}${s}${filename}"

11
.config/nsxiv/exec/win-title Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
exec 2>/dev/null
filename="${1##*/}"
if [ -n "$4" ]; then # image mode
printf "%s" "nsxiv - ${filename} | ${4}x${5} ${6}% [${2}/${3}]"
else
printf "%s" "nsxiv - ${filename} [${2}/${3}]"
fi