#! /bin/bash
# .gnome2/nautilus-scripts/word-count

# I, the Copyright holder of this work, hereby release it into the Public
# Domain. This applies worldwide. In case this is not legally possible, I
# grant anyone the right to use this work for any purpose, without any
# conditions, unless such conditions are required by law.
#
# 2009 Timothy Richard Musson <trmusson@gmail.com>

PROG=$(basename $0)

if [ "$1" = '-h' ]; then
  echo "Usage: $PROG FILE..."
  exit 0
fi

XMESSAGE=$(which gxmessage) || XMESSAGE=xmessage

font=monospace
[ "$XMESSAGE" = xmessage ] && font=fixed

[ "$#" -ge 1 ] &&
  wc "$@" 2>&1 | $XMESSAGE ${font:+-fn "$font"}     \
                         -title "$PROG"             \
                         -nearmouse                 \
                         -buttons GTK_STOCK_CLOSE:0 \
                         -default GTK_STOCK_CLOSE   \
                         -file -

