Ubuntu – How to launch an Xulrunner app with a desktop shortcut

desktoplubuntushortcutsxulrunner

I have created a simple xulrunner app and it works great when invoked from command line.

clain@desktop:~$ xulrunner /home/clain/myapp/application.ini

The problem is that I need to keep the terminal open while the app is running. is there a way I can launch the app with a desktop shortcut / desktop entry?

I have tried to make a desktop entry file like below but when running it I got the error "Invalid desktop entry file: '/home/clain/Desktop/myapp'"

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=MyApp
GenericName=MyApp XulRunner
Exec=xulrunner /home/clain/myapp/application.ini
TryExec=xulrunner /home/clain/myapp/application.ini
Terminal=false
Type=Application
MimeType=text/xml;application/xhtml+xml;application/x-javascript;application/x-php;application/x-java;text/x-javascript;text/html;text/plain;

Name[en_IN]=MyApp
Comment[en_IN]=Standalone MyApp SSB

I am running on Lubuntu 14.04 LTS (Trusty Tahr)

Best Answer

You have a couple of options.

You could either run from the graphical "Run Command" - the equivalent of Windows + R. You can also find this in the start menu on Windows.

On Ubuntu, you use Alt + F2 to open this:

And on lubuntu it is "Menu" -> "Run".

And then run the command

xulrunner /home/clain/myapp/application.ini

graphically, without a terminal being needed.


Your second option is to run in a terminal, but unlink it from the terminal with the & character, like so:

xulrunner /home/clain/myapp/application.ini &

this will start it as a separate process. Here is an example with Gedit:

As you can see, I can run another command without affecting Gedit. It will keep running. If I was to not use the & the terminal would be attached. Closing the terminal gives this message:

And of course if I do close it Gedit will stop. If I use the &, there is no active process so the terminal can just be closed.


Finally, if you do really need a desktop shortcut, you could use this .desktop file.

[Desktop Entry]
  Version=1.0
  Encoding=UTF-8
  Name=MyApp
  Exec=xulrunner /home/tim/xulrunner/application.ini
  Terminal=false
  Type=Application

I've cut out the unnececary parts which, so this may work. Add in the line Icon = /path/to/iconname.svg to give it an icon.

Also note that you can simply put an icon is ~/.icons or /usr/share/icons. Then if your icon name is "MyApp.svg" just use the line Icon = MyApp.

If you still want the "TryExec" line, which isn't needed, A.B.'s answer explains why you do.

Related Question