Can anyone provide a reference or explain how the icons to the alt-tab list is populated? I would like to specify some icons for some programs that do not have icons, e.g. xterm. I'm using Ubuntu 11.04 with Gnome 2 (Ubuntu Classic) and metacity as the window manager.
I did see this thread that mentions /usr/share/pixmap/, but if I use cp gnome-terminal.xpm xterm.xpm
the icon was not populated in the alt-tab icon list (even after a logout/login). I do see that the icon is populated when I added the xterm command to the Program Menu.
Best Answer
The window manager probably obtains this information from
.desktop
files. (I can confirm with GNOME 3 Shell, but should be the same in Metacity.)These days every graphical program installs a file or several to
/usr/share/applications
(you can add your own to~/.local/share/applications
). It's an INI-format file containing the basic information about that program according to Desktop Entry Specification: name, primary executable, icon, ... For running programs, the window manager matches the window owner to the program named inExec=
line.(When you add items to the GNOME menu, they are automatically stored in
.desktop
files.)For example, I have written the following as
~/.local/share/applications/xterm.desktop
to make my Xterm have a generic "terminal" icon:The
Icon
key may be an absolute path to an image, or an icon name according to Icon Theme Spec. The system comes with/usr/share/icons
, and you can put your own to~/.local/share/icons
. (If it doesn't exactly match the naming spec,hicolor/256x256/program.png
will be fine.)Note that the preferred format is PNG, which has more capabilities than XPM.