Getting application name and icon right with XULRunner · 2007-06-29 02:21 by Wladimir Palant
Despite a few disadvantages, XULRunner is a great tool for application development. The more disappointing it is when the very basic things fail: getting your application recognizable by its icon and application name. Setting icon and title for application’s windows is easy, and usually it is sufficient. However, Windows taskbar has the option “Group similar taskbar buttons” (enabled by default), and for a XULRunner application this group is displayed with XULRunner’s icon and the name “xulrunner”.
Not the fault of XULRunner as it comes out. Windows gets these parameters from resources of the executable which happens to be xulrunner.exe in this case. For the name it looks at the FileDescription field of the VERSIONINFO resource. In XULRunner this field is empty, consequently the filename is taken instead. The problem with this solution is that the application has no way to select the icon or the description at runtime, resources are added to the executable during compilation. Sun hit the same problem with Java and AFAICT didn’t find any real solution either.
The issue is relatively easy to solve if your application runs on a private XULRunner build that you compile yourself. There you can make sure that the icon of the executable as well as the FileDescription field match your application. But that’s awkward — why do we have to change XULRunner before we can use it?
At the developer day Benjamin Smedberg mentioned that there is another solution to this problem: using xulrunner-stub.exe. xulrunner-stub is an executable that you put into your application directory (the directory of application.ini), when started it will find a compatible XULRunner installation and execute your application. The good thing is that you can easily rename xulrunner-stub into anything you like, and that will be the name displayed in the taskbar. You can also add an icon to it without recompiling, e.g. by using Resource Hacker. The bad news: this only works with XULRunner 1.9, for older versions of xulrunner-stub the process is still associated with xulrunner.exe. And more bad news: due to bug 386152 you currently need to add the manifest resource from xulrunner.exe to xulrunner-stub.exe, otherwise it will be unusable.
I tried to sum up the instructions in the XULRunner tips article on MDC. In the current state it is a raw draft at best, so feel free to improve the text.
And as a bonus another small detail: Windows doesn’t really read the FileDescription field every time buttons are grouped. It actually only reads it once and stores the result under HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache in the registry. So if you wonder why your changes don’t get picked up — that’s why.
Dear Microsoft developers, if any of you happen to read this: we all love Raymond. But please, could you maybe document these details? It could save the lives of many innocent developers who would otherwise die a painful death banging their head against the keyboard. And I don’t even dare to ask for a way to change application name/icon at runtime…
Commenting is closed for this article.