Krolyxon
Commit af69b2a

Branches

Refs →

nsxivimage-info

19 lines · 499 B · Bourne Again Shell (bash)

1#!/bin/sh
2
3# Example for ~/.sxiv/exec/image-info
4# Called by sxiv(1) whenever an image gets loaded,
5# with the name of the image file as its first argument.
6# The output is displayed in sxiv's status bar.
7
8s=" | " # field separator
9
10filename=$(basename "$1")
11filesize=$(du -Hh "$1" | cut -f 1)
12
13geometry=$(identify -format '%wx%h' "$1[0]")
14
15tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }')
16tags=${tags%,}
17
18echo "${filesize}${s}${geometry}${tags:+$s}${tags}${s}${filename}"
19