Alt-tab icon list in Gnome and metacity?

5

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.

Vinh Nguyen

Posted 2011-09-09T03:23:45.863

Reputation: 265

just FYI, you're running an End-of-Life'd ubuntu release: https://lists.ubuntu.com/archives/ubuntu-announce/2012-October/000165.html: Please consider upgrading to a newer version.

– Carlos Campderrós – 2012-11-20T10:43:46.653

Answers

2

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 in Exec= 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:

[Desktop Entry]
Name=XTerm
Comment=Use the command line
Exec=xterm
Icon=utilities-terminal
Type=Application
Categories=Utility;TerminalEmulator;

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.

user1686

Posted 2011-09-09T03:23:45.863

Reputation: 283 655

Thanks for your response. I tried creating the .desktop files, and placed my icons in ~/.local/share/icons. This indeed influences the icons the application menu ("Windows start" button). However, the icons in the alt-tab list still does not change. Any other suggestions? – Vinh Nguyen – 2011-09-09T17:46:15.540

Confirmed this is the case in both cases where the files are placed in the /usr/share and ~/.local/share. – Vinh Nguyen – 2011-09-09T17:56:57.423

@Vinh: Even after restarting Metacity? – user1686 – 2011-09-09T18:25:19.673

I restarted after every change (don't know how to restart Metacity itself). – Vinh Nguyen – 2011-09-09T19:22:38.347

any more thoughts??? – Vinh Nguyen – 2011-09-10T15:33:48.363

1

The name of the executable whose icon you want to have appear in the alt-tab listing and the name of the file in /home/assure/.local/share/applications must be the same in order for this to work.

Rob

Posted 2011-09-09T03:23:45.863

Reputation: 178

I have the following:

$ cat .local/share/applications/xterm.desktop [Desktop Entry] Name=XTerm Comment=Use the command line Exec=xterm Icon=utilities-terminal Type=Application Categories=Utility;TerminalEmulator;

Can you give an example for xterm? – Vinh Nguyen – 2012-11-21T15:27:04.773