aboutsummaryrefslogtreecommitdiffstats
path: root/.config/sxiv/exec/image-info
diff options
context:
space:
mode:
Diffstat (limited to '.config/sxiv/exec/image-info')
-rwxr-xr-x.config/sxiv/exec/image-info24
1 files changed, 13 insertions, 11 deletions
diff --git a/.config/sxiv/exec/image-info b/.config/sxiv/exec/image-info
index 690ec17..f1c6298 100755
--- a/.config/sxiv/exec/image-info
+++ b/.config/sxiv/exec/image-info
@@ -1,19 +1,21 @@
#!/bin/zsh
-# Example for ~/.sxiv/exec/image-info
-# Called by sxiv(1) whenever an image gets loaded,
-# with the name of the image file as its first argument.
-# The output is displayed in sxiv's status bar.
+# Example for $XDG_CONFIG_HOME/nsxiv/exec/image-info
+# Called by nsxiv(1) whenever an image gets loaded.
+# The output is displayed in nsxiv's status bar.
+# Arguments:
+# $1: path to image file (as provided by the user)
+# $2: image width
+# $3: image height
+# $4: fully resolved path to the image file
s=" | " # field separator
-filename=$(basename "$1")
-filesize=$(du -Hh "$1" | cut -f 1)
+exec 2>/dev/null
-geometry=$(identify -format '%wx%h' "$1[0]")
+filename=$(basename -- "$1")
+filesize=$(du -Hh -- "$1" | cut -f 1)
+geometry="${2}x${3}"
-tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }')
-tags=${tags%,}
-
-echo "${filesize}${s}${geometry}${tags:+$s}${tags}${s}${filename}"
+echo "${filesize}${s}${geometry}${s}${filename}"