#!/bin/sh - widcmd='xwinid XTerm' # xtitletag - set a tag string in the title of an X11 terminal window # Steve Kinzler, kinzler@cs.indiana.edu, Jan 02/Feb 04 # http://www.cs.indiana.edu/~kinzler/home.html#x11 WINDOWID="${WINDOWID-`$widcmd`}" case "$1" in -h) echo "$WINDOWID" echo "usage: $0 [ tag | | [',./;] | - | = ]" 1>&2; exit 1;; esac title=`xprop -id "$WINDOWID" | sed -n 's/^WM_NAME([^"]*"\(.*\)"$/\1/p'` case "$*" in =) char=; tag=; patt=;; -) char=; tag=; patt='s/^.) *//';; [\',./\;]) char="$*) "; tag=; patt='s/^.) *//';; '') char=; tag=; patt='s/ *\[.*\]//';; *) char=; tag=" [$*]"; patt='s/ *\[.*\]//';; esac xtitle -q "$char"`echo "$title" | sed "$patt"`"$tag" > /dev/tty echo "$WINDOWID"