Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am creating an GTK3 python application for Ubuntu. At the moment the application installs in the following locations.

In /opt/NSTrain folder where NSTrain is the name of my application. The NSTrain folder has the executable .py files, its icons, gui files and other library files. It also installs a .desktop file to /usr/share/applications folder.

Here are the contents of my .desktop file,

[Desktop Entry]
Name=NSTrain
X-GNOME-FullName=NSTrain
Comment=Train Scheduler Application
Categories=GNOME;Utility;
Exec=/opt/NSTrain/nstrain.py
Icon=/opt/NSTrain/app-icon.png
Terminal=false
Type=Application

I see my application in the application lens with the appropriate icon. However when I click it, nothing happens. The nstrain.py file is executable and works fine when I execute it from the terminal using ./nstrain.py command.

What is the issue here?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Does your application assume you are starting it from the folder /opt/NSTrain/? If so add the line

Path=/opt/NSTrain/

to your .desktop file. That tells Unity (or Gnome Shell or from whatever program you are using to start your application) to start your program in the given folder.

Without that line your application gets started from the current working folder of Unity (or whatever), which usually is your home folder. That will break your application if it assumes it is started from /opt/NSTrain/ and hence tries to open a file like /opt/NSTrain/somefile.dat just as somefile.dat.

If that doesn't help please start your application in a Terminal from your home folder using /opt/NSTrain/nstrain.py and post any error messages you get.

share|improve this answer
    
Thank you very much adding Path to the desktop file fixes the issue. May I ask if you can may be expand the answer to why Path is required in this case? It might help future users. –  nik90 May 21 '12 at 22:50
    
Ok, did that. Hope that helps :-) –  Florian Diesch May 21 '12 at 23:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.