Krolyxon
Commit ba39006

Branches

Refs →

nsxivetcexamplesthumb-info

20 lines · 463 B · Bourne Again Shell (bash)

1#!/bin/sh
2
3# Example for $XDG_CONFIG_HOME/nsxiv/exec/thumb-info
4# Called by nsxiv(1) whenever the selected thumbnail changes.
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: empty
9# $3: empty
10# $4: fully resolved path to the image file
11
12s=" " # field separator
13
14exec 2>/dev/null
15
16filename=$(basename -- "$4")
17filesize=$(du -Hh -- "$4" | cut -f 1)
18
19echo "${filesize}${s}${filename}"
20