Replacing a window icon in X11?
Lubos Lunak
l.lunak at suse.cz
Thu Apr 2 03:05:26 PDT 2009
On Thursday 02 of April 2009, Glynn Clements wrote:
> Wirawan Purwanto wrote:
> > Today most window managers has an area on the top left corner of the
> > window decoration which shows a small bitmap, which in Windows world
> > called "icon". I wonder if there is any way for an external program, if
> > it knows the window ID of a given X11 window, to change that image to
> > something else.
> The property in question is WM_HINTS, which is set using the
> XSetWMHints() function. The property contains multiple fields, so in
> order to preserve any existing hints, you would need to read the
> existing value with XGetWMHints(), modify it, then write the updated
> value.
Nowadays it is actually mostly the _NET_WM_ICON hint from the EWMH spec.
Toolkits generally have functions for changing it, although it's a question
if they can do it for foreign windows (no idea about Gtk, Qt can't, KDE's
NETWinInfo::setIcon() can).
> But as Daniel suggests, most window managers provide a mechanism to
> override a window's icon (or lack of one).
I doubt that's the case, especially when interpreting 'most' as 'most people
use'. Still, adding this if necessary should be the best option, given what's
below.
> This would normally be
> preferable to modifying the WM_HINTS property. Apart from anything
> else, it's possible that your changes will be discarded whenever the
> application (or WM) updates the WM_HINTS property.
--
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail: l.lunak at suse.cz , l.lunak at kde.org
Lihovarska 1060/12 tel: +420 284 028 972
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http://www.suse.cz
More information about the xorg
mailing list