dotfiles

personal configuration files and scripts
git clone https://tongong.net/git/dotfiles.git
Log | Files | Refs | README

image-info (427B)


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