Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 05, 2016, 06:58:12 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: XULRunner - XUL & JS For Desktop Applications  (Read 7877 times)

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
XULRunner - XUL & JS For Desktop Applications
« on: September 11, 2008, 07:04:01 PM »
Hey all. I imagine just about anyone who has ever done a Firefox extension has wished that creating cross-platform desktop applications was that easy. Naturally, Mozilla has had the foresight to make this possible for quite some time, they just suck at marketing ;)

Meet XULRunner. This application allows programmers do use XUL and JavaScript to create fully featured desktop applications with all the functionality of XPCOM. This makes coding your application that much easier, and that every single Firefox extension potentially contains example code that a developer can leverage to their benefit.

XULRunner itself currently occupies about 20 megabytes on disk, but can be compressed to ~6mb using lzma or bzip2. It is recommended that you package XULRunner with your application, however if you make an update URL available (XULRunner has a built in updater similar to Firefox's) you can use Firefox or Mozilla to run your application in a separate instance and update it should a platform update break your application.

For anyone interested, as an example, let's take Alice Corbin's excellent XUL sample here, and turn it into an XULRunner application. She very kindly makes it available in zip which can be downloaded here. First, we'll need a copy of XULRunner from here (SDK w/ runtime here). To follow certain steps later on, you should execute 'xulrunner --register-user' after extracting it. To start, we'll create a directory called 'top' where you'd like the application to be, and beneath it create a structure like this:
Quote
|-application.ini
|-chrome
  |-chrome.manifest
  \-content
|-defaults
  |-preferences
    \-prefs.js
Application.ini stores your program's metadata, it will look like this (where <GUID> is a globally unique identifier; it can be a guid or your email address etc):
Quote
[App]
Name=top
Version=1.0
BuildID=20060105
ID=<GUID>

[Gecko]
MinVersion=1.8
MaxVersion=1.9

Fairly self explanatory I think. Next we'll open chrome/chrome.manifest. In here we'll tell Gecko where to find the actual content of our application by adding this line:
Quote
content top content/
This tells Gecko that the content of our application can be found in the subdirectory 'content'. The content directive supports full relative paths, so you can place your content in a folder beside application.ini and use "content top ../content/" if you'd prefer. NOTE: The directory you specify *must* end in a slash.

Next, we open defaults/preferences/prefs.js. In here you can set all your default preferences, but for this application we will need only this line:
Quote
pref("toolkit.defaultChromeURI", "chrome://top/content/top.xul");
This line tells Gecko which file from the content directory we would like it to create the initial window from (similar in a sense to index.html/default.htm).

Finally, we'll extract the contents of xulpt.zip into the chrome/content directory. You'll notice the zip contains the top.xul file referenced above. Now we can test out our new application by launching it with XULRunner. To do this, open a command prompt and navigate to the folder where you installed XULRunner. Say you put your application in the 'top' directory beneath your XULRunner directory, you would execute "xulrunner top\application.ini" and you'll see your new application appear on the desktop.

For anyone interested in distributing applications they create, XULRunner harbors the same installer system as Firefox, though it is invoked in a different fashion. What you'll need to do to make use of it is zip up your application into top.zip (with application.ini in the root). Rename top.zip to top.xpi. Then, execute 'xulrunner --install-app C:\path\to\top.xpi C:\path\to\install\to'. This will install your application to the specified path (or the default path if the last parameter is omitted), and XULRunner will create a friendly stub application that users can use to launch your application with requiring a console.

top.pngXULRunner - XUL & JS For Desktop Applications   xulrunner.pngXULRunner - XUL & JS For Desktop Applications

Finally, here are some links for potential developers to peruse:
-XULRunner Hall of Fame Applications
-Chrome Registration
-Installer Bundles
-The Chrome URI
-Mark Finkle's XUL Blog
-Richard Crowley's XULRunner Blog
-XUL Code Snippets
-XUL/JS Example Code

Hope this helps some people, and please leave any constructive criticism in a reply. If anything doesn't work for you leave a comment in the replies and I'll see if i can help.

Ehtyar.
« Last Edit: September 11, 2008, 07:57:51 PM by Ehtyar »

mahesh2k

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,417
    • View Profile
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #1 on: September 12, 2008, 04:28:35 AM »
Thanks Ehtyar
My friend is Working on FF these days, this info will definitely helpful for him..
 :Thmbsup:

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,406
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #2 on: September 14, 2008, 08:02:08 AM »
Very cool stuff.. has anyone here done any XUL application building? I have a book on it but i've only just skimmed it.

VideoInPicture

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 467
    • View Profile
    • Circle Dock
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #3 on: September 14, 2008, 01:49:57 PM »
I'll have to check this out when I get more time. I'll have to see how easy it is to code with.

I'm currently re-learning Java development so I'm wondering what advantages XULRunner would have over Java since they are both cross-platform.
Author of Circle Dock: http://circledock.wikidot.com
Author of Video In Picture: http://videoinpicture.wikidot.com
Author of Webcam Signature: http://webcamsignature.wikidot.com
Author of Easy Unicode Paster: http://easyunicodepaster.wikidot.com

wuwei23

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 28
    • View Profile
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #4 on: October 08, 2008, 10:08:06 PM »
I'm currently re-learning Java development so I'm wondering what advantages XULRunner would have over Java since they are both cross-platform.
The BIG advantage I can see is it isn't Java ;)

Seriously though, I can see it being more useful to people who are primarily experienced as web developers. XULRunner lets you create desktop apps using HTML/CSS/Javascript, which is a powerful combo if you're already using them.

While I haven't tried it, I do plan on using XULRunner for at least a small project sometime soon, especially as its easy to use Python while doing so: Python XULRunner Application

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #5 on: October 08, 2008, 11:27:39 PM »
I'm currently re-learning Java development so I'm wondering what advantages XULRunner would have over Java since they are both cross-platform.
The BIG advantage I can see is it isn't Java ;)
Hehehe, I was going to keep my mouth shut, but I see I needn't have :P
Seriously though, I can see it being more useful to people who are primarily experienced as web developers. XULRunner lets you create desktop apps using HTML/CSS/Javascript, which is a powerful combo if you're already using them.
HTML & JS are widely considered to be some of the best languages for beginners. I would consider XULRunner to also be a good training package, not just for web developers.
While I haven't tried it, I do plan on using XULRunner for at least a small project sometime soon, especially as its easy to use Python while doing so: Python XULRunner Application
I've come across the Python interface before, but not being a huge fan of python myself (shutup tin man :P) I never tried it. After reading your post I decided to give it a once over. The interoperability is rather impressive to me, though I don't see any huge benefit, unless you're really into python and don't mind the additional performance hit. The examples [1] provided there are a bit rough around the edges, so you will need to do some work to get them to run. If anyone woiuld like assistance in this area, feel free to reply or pm me.

Ehtyar.

wuwei23

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 28
    • View Profile
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #6 on: October 08, 2008, 11:46:26 PM »
I've come across the Python interface before, but not being a huge fan of python myself (shutup tin man :P) I never tried it. After reading your post I decided to give it a once over. The interoperability is rather impressive to me, though I don't see any huge benefit, unless you're really into python and don't mind the additional performance hit.

The benefit is that Python rawks and the only performance speed I really care about is how fast I can develop :)

Quote
The examples [1] provided there are a bit rough around the edges, so you will need to do some work to get them to run. If anyone woiuld like assistance in this area, feel free to reply or pm me.

I will definitely take you up on this offer once I start to play around with XULRunner, cheers!

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #7 on: October 09, 2008, 07:28:08 AM »
but not being a huge fan of python myself (shutup tin man :P) I never tried it.

 :lol:

tinjaw

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • View Profile
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #8 on: October 09, 2008, 07:42:39 AM »
While I haven't tried it, I do plan on using XULRunner for at least a small project sometime soon, especially as its easy to use Python while doing so: Python XULRunner Application

Just yesterday I exercised XULRunner from my Someday/Maybe list because I don't want to do Yet Another Framework. I am trying to concentrate on using Python exclusively so I can get better at it.

Then you post about this. Something I hadn't yet heard about.

 :-*

(XULRunner + pyxpcomext) is now on the Someday/Maybe list

housetier

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 1,321
    • View Profile
    • Donate to Member
Re: XULRunner - XUL & JS For Desktop Applications
« Reply #9 on: November 07, 2008, 07:47:26 AM »
I tried to run that simple xulrunner application also, but failed. There is something b0rken in my Linux-System: https://bugs.launchp...nner-1.9/+bug/295151

Let's when it'll be fixed.