Window naming

"Matthew D. Fuller" <[email protected]>
Newsgroups gmane.comp.window-managers.ctwm
Message-ID <[email protected]>
I've just landed support in trunk for the EWMH window title/icon name
properties.  The most visible consequence of this will be that Chrome
and its downstreams will now actually wind up with visible titles (and
icon names, copied from the title, since it doesn't actually set those
itself, 'cuz Chrome).

This does have one unfortunate side effect.  Since we now see the
names Chrome gives itself, and follow how they change all the time,
Aaron will have to hunt me down and pull out all my fingernails.  So
if this is the last time anybody hears from me, you'll all know what
happened!


But I did also add an escape hatch; we now support CTWM_WM_NAME and
CTWM_WM_ICON_NAME properties as well, which override the EWMH or ICCCM
properties if set.  The intention is for these to be manually set by
the user when they wish, to override the title or icon name for their
own reasons.  This is better than manually setting WM_NAME or
WM_ICON_NAME, since this properties conceptually belong to the app and
it can (and will) change them at its discretion, which the CTWM_*
variants shouldn't be programmatically touched, so you can set it and
it'll stay there.

Due to have xprop(1) requires you to set the formats for non-standard
properties, it's a little inconveniently repetititive to run the
commands to set them; see notes in CHANGES and the manual about just
how you have to phrase things.  I've attached here a slightly cleaned
up variant of the sh-ery I used in testing this, which makes a
slightly more convenient frontend.  e.g.:

% ./override_win_name 'asdf'    (then click the win)
    Set the override icon name, changing it in the icon manager
% ./override_win_name -t 'asdf'
    Set the override title, in the titlebar
% ./override_win_name -tr
    Remove the override title

And since it passes the remaining args on to xprop, you can also use
any other bits xprop supports, like using -name or -id to specify a
window rather than waiting to click on it.  e.g.,

% ./override_win_name -t 'asdf' -- -id 0x504030


-- 
Matthew Fuller     (MF4839)   |  [email protected]
Systems/Network Administrator |  http://www.over-yonder.net/~fullermd/
           On the Internet, nobody can hear you scream.
override_win_name.sh (application/x-sh, 657 B)
#!/bin/sh
# Set CTWM props to override a windows title/icon name

usage()
{
	echo "Usage: $0 [-i | -t] <name>"
	echo "       $0 [-i | -t] -r"
	echo "  -i   Set/clear icon name (default)"
	echo "  -t   Set/clear window title"
	echo "  -r   Remove chosen property"
	exit 1;
}

prop="CTWM_WM_ICON_NAME"
remove=""
while getopts itrh arg; do
	case $arg in
		i)  prop="CTWM_WM_ICON_NAME" ;;
		t)  prop="CTWM_WM_NAME" ;;
		r)  remove="remove" ;;
		-)  break; ;;
		h)  usage ;;
		?)  usage ;;
	esac
done
shift $(($OPTIND - 1))

if [ -n "${remove}" ]; then
	xprop -remove ${prop} "$@"
else
	if [ -z "$1" ]; then
		usage
	fi
	xprop -f ${prop} 8u -set ${prop} "$@"
fi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.