Skip navigation

Something To Do On A Sunday Afternoon

Let’s Manifest Ourselves

Enter the xulapp directory and create an executable shell script to set the correct path and launch our application, we call it xulapp.sh:

#!/bin/sh
PATH=$PATH:$(pwd)/../xulrunner xulrunner application.ini

It will set the path temorarily and launch XULRunner and give application.ini as an argument. The INI-file is read by XULRunner upon launch so that’s the next thing we need to create:

[App]
Vendor=XulApp Co.
Name=xulapp
Version=0.1
BuildID=20060128
Copyright=Copyright (c) 2006 XulApp Co.
ID={506e456c-8dbf-4f1c-17b8-aff5bdd7592}

[Gecko]
MinVersion=1.8
MaxVersion=1.8

In defaults/preferences/ create a prefs.js file:

pref("toolkit.defaultChromeURI","chrome://xulapp/content/start.xul");

This tells XUL Runner to load start.xul at startup. Think of it as the XUL equivalent of the main() function in C/C++.

Next in chrome/ create the chrome.manifest file:

content xulapp file:content/xulapp/

What the manifest do is to map the chrome://xulapp/content URI to the content/xulapp/ directory in the filesystem.

Greet the World

So now we have set up the XULRunner environment to develop our ass-kicking application.

We’ve already defined start.xul to be our entry point so we better have to create it then:

<?xml version="1.0"?>
<?xml-stylesheet xhref="chrome://global/skin/" type="text/css"?>
<window id="helloworld-window" title="Hello, World!" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<button id="helloworld-button" label="Hello, World!" />
</window>

And put it in the created content directory. This will just create a window with a button that says “Hello, World!”. From here you can go on creating you application just like any other XUL application [2].

References

[1] http://developer.mozilla.org/en/docs/XULRunner

[2] http://developer.mozilla.org/en/docs/XUL

8 comments

  1. Posted January 30, 2006 at 0:31 | Permalink

    Ok, that’s all for now. I wrote this very quickly and there probably are some errors and overlooked issues in the tutorial.

    Will get bakc to it when time permit.

  2. Andreas Schenk
    Posted February 19, 2006 at 1:23 | Permalink

    Hi,

    there is indeed one minor error….

    The window you give in start.xul is not displayed because it is empty. Better put something in it, a label, button or something like that.

    Regards,

    Andreas.

  3. Jeffrey Lyon
    Posted March 16, 2006 at 7:43 | Permalink

    Did everything mentioned in the tutorial, double and triple checked, and finally added the following in the start.xul (before the tag):

    Alas, no joy (or xulrunner window, or even error messages). Would it be possible to post a zip file containing all the directories and files?

    Jeff

  4. Charles Ginzel
    Posted March 19, 2006 at 0:52 | Permalink

    Jeffrey, for me i had to modify the xulapp.cmd file on windows to be ..\xulrunner\xulrunner application.ini and then i got a small window to appear with nothing within it… but if you put something in there it works fine…

  5. Posted March 26, 2006 at 16:04 | Permalink

    Aw. Here I was thinking that I was going to get some ideas of what I could do with my Sunday afternoon.

  6. chenhui
    Posted November 3, 2006 at 5:53 | Permalink

    ok

  7. Anonymous
    Posted December 4, 2006 at 6:01 | Permalink

    I also followed the instructions to the letter and nothing appeared. xulrunner appeared in the process list and all, but nothing was shown.

    I do not know where I got the inspiration but an idea appeared in my mind: I renamed all the directories to lower case and changed the name of the app to lower case in all the files and it finally started! why is this not mentioned anywhere? go figure

  8. Posted December 4, 2006 at 12:32 | Permalink

    All the directories in my blog post are lowercase, so I don’t see why anyone would get the idea of making them uppercase?

Post a comment

Your email is never published nor shared. Required fields are marked *
*
*
Creeper