From 9c0a53bc34c53424613ee203253fee526ba9f049 Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Sun, 27 Jan 2013 18:03:01 +0100 Subject: Added documentation for image-info script --- Makefile | 8 ++++++-- README.md | 4 ++-- image-info | 17 ++++++++++++----- sxiv.1 | 19 +++++++++++++++---- 4 files changed, 35 insertions(+), 13 deletions(-) mode change 100755 => 100644 image-info diff --git a/Makefile b/Makefile index 9d3afd3..d542281 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = git-20130112 +VERSION = git-20130127 PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man @@ -32,9 +32,13 @@ install: all cp sxiv $(DESTDIR)$(PREFIX)/bin/ chmod 755 $(DESTDIR)$(PREFIX)/bin/sxiv mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - sed "s/VERSION/$(VERSION)/g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1 + sed "s!PREFIX!$(PREFIX)!g; s!VERSION!$(VERSION)!g" sxiv.1 > $(DESTDIR)$(MANPREFIX)/man1/sxiv.1 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/sxiv.1 + mkdir -p $(DESTDIR)$(PREFIX)/share/sxiv/exec + cp image-info $(DESTDIR)$(PREFIX)/share/sxiv/exec/image-info + chmod 755 $(DESTDIR)$(PREFIX)/share/sxiv/exec/image-info uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/sxiv rm -f $(DESTDIR)$(MANPREFIX)/man1/sxiv.1 + rm -rf $(DESTDIR)$(PREFIX)/share/sxiv diff --git a/README.md b/README.md index a564bb4..d8c1c7a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ sxiv ==== -**Simple (or small or suckless) X Image Viewer** +**Simple X Image Viewer** sxiv is an alternative to feh and qiv. Its only dependencies besides xlib are imlib2 and giflib. The primary goal for writing sxiv is to create an image @@ -20,7 +20,7 @@ Features * Ability to cache thumbnails for fast re-loading * Basic support for multi-frame images * Load all frames from GIF files and play GIF animations -* Display image information in window title +* Display image information in status bar Screenshots diff --git a/image-info b/image-info old mode 100755 new mode 100644 index e65e06a..3c03a3f --- a/image-info +++ b/image-info @@ -1,10 +1,17 @@ #!/bin/sh -#filename=$1 -#filesize=$(du -h "$1") +# Example for ~/.sxiv/exec/image-info +# Called by sxiv(1) whenever an image gets loaded, +# with the name of the image file as its first argument. +# The output is displayed in sxiv's status bar. -#geometry=$(identify -format '%wx%h' "$1") +filename=$(basename "$1") +filesize=$(du -h "$1" | cut -f 1) -#tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" {print $4","}') -#tags=${tags%,} +geometry=$(identify -format '%wx%h' "$1") + +tags=$(exiv2 -q pr -pi "$1" | awk '$1~"Keywords" { printf("%s,", $4); }') +tags=${tags:+|}${tags%,} + +echo "[$filesize|$geometry$tags] $filename" diff --git a/sxiv.1 b/sxiv.1 index b963a17..6f61561 100644 --- a/sxiv.1 +++ b/sxiv.1 @@ -1,6 +1,6 @@ .TH SXIV 1 sxiv\-VERSION .SH NAME -sxiv \- Simple (or small or suckless) X Image Viewer +sxiv \- Simple X Image Viewer .SH SYNOPSIS .B sxiv .RB [ \-bcdFfhpqrstvZ ] @@ -306,6 +306,15 @@ Pan image left. .TP .B Shift+ScrollDown Pan image right. +.SH STATUS BAR +The information displayed on the left side of the status bar can be replaced +with the output of a user-provided script, which is called by sxiv whenever an +image gets loaded. The path of this script is +.I ~/.sxiv/exec/image-info +and the first argument to this script is the path of the loaded image. +.P +There is also an example script installed together with sxiv as +.IR PREFIX/share/sxiv/exec/image-info . .SH THUMBNAIL CACHING To enable thumbnail caching, please make sure to create the directory .I ~/.sxiv/cache/ @@ -325,17 +334,19 @@ find . \-depth \-type d \-empty ! \-name '.' \-exec rmdir {} \\; .RE .SH AUTHOR .EX -Bert Muennich +Bert Muennich .EE .SH CONTRIBUTORS .EX Bastien Dejean Dave Reisner Fung SzeTat -.EX +.EE .SH HOMEPAGE -.TP +.EX +http://muennich.github.com/sxiv https://github.com/muennich/sxiv +.EE .SH SEE ALSO .BR feh (1), .BR qiv (1) -- cgit v1.2.3-54-g00ecf