aboutsummaryrefslogtreecommitdiff
path: root/config/sxiv/exec/image-info
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2021-06-01 21:44:12 +0530
committerAkshay Nair <phenax5@gmail.com>2021-06-01 21:44:12 +0530
commitdae97302c821e709654ce25204fd0a7485ce05aa (patch)
tree5206e580e4c843f6b61080f8e8745a2897b302b9 /config/sxiv/exec/image-info
parent8d29a49ec6afcff5802488ac062d54ba276bee0f (diff)
downloadnixos-config-dae97302c821e709654ce25204fd0a7485ce05aa.tar.gz
nixos-config-dae97302c821e709654ce25204fd0a7485ce05aa.zip
Adds sxiv config
Diffstat (limited to 'config/sxiv/exec/image-info')
-rwxr-xr-xconfig/sxiv/exec/image-info19
1 files changed, 19 insertions, 0 deletions
diff --git a/config/sxiv/exec/image-info b/config/sxiv/exec/image-info
new file mode 100755
index 0000000..155ca0e
--- /dev/null
+++ b/config/sxiv/exec/image-info
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+
+# Example for $XDG_CONFIG_HOME/sxiv/exec/image-info
+# Called by sxiv(1) whenever an image gets loaded.
+# The output is displayed in sxiv's status bar.
+# Arguments:
+# $1: path to image file
+# $2: image width
+# $3: image height
+
+s=" " # field separator
+
+exec 2>/dev/null
+
+filename=$(basename -- "$1")
+filesize=$(du -Hh -- "$1" | cut -f 1)
+geometry="${2}x${3}"
+
+echo "${geometry}${s}${filesize}${s}${filename}"