Krolyxon
Commit 0e1bc3c

Branches

Refs →

nsxivetcexamplesimage-info

21 lines · 502 B · Bourne Again Shell (bash)

1#!/bin/sh
2
3# Example for $XDG_CONFIG_HOME/nsxiv/exec/image-info
4# Called by nsxiv(1) whenever an image gets loaded.
5# The output is displayed in nsxiv's status bar.
6# Arguments:
7# $1: path to image file (as provided by the user)
8# $2: image width
9# $3: image height
10# $4: fully resolved path to the image file
11
12s=" " # field separator
13
14exec 2>/dev/null
15
16filename=$(basename -- "$1")
17filesize=$(du -Hh -- "$1" | cut -f 1)
18geometry="${2}x${3}"
19
20echo "${filesize}${s}${geometry}${s}${filename}"
21