Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create a quick launch icon for MATLAB, but it won't start if the working directory is not the same as the directory where the executable is. Can I specify the working directory in the 'Custom Application Launcher'?

Custom launcher

share|improve this question
up vote 9 down vote accepted

You can set the working directory natively, but for some reason it's not supported in the user interface. The underlying .desktop file itself supports a Path key for "the working directory to run the program in" (see the spec) as long as your launcher is an "Application" type.

So just open the .desktop file in a text editor (if you're having trouble finding it, you can create the launcher on your desktop and find it in ~/Desktop, then move it later), and add a line at the end that says Path=YOUR_PATH.

share|improve this answer
Amazing. I can't believe Gnome is missing this in the UI. Any idea if it's visible in latest gnome versions? – user1338062 Feb 20 '13 at 17:26
I don't think it's been added, and in fact I think recent versions of gnome dropped the "Create Application Launcher" option. I recommend as a replacement. – Mu Mind Feb 21 '13 at 5:37

Change the Command to this (substituting the correct paths of course):

bash -c "cd /path/to/directory && /path/to/directory/executable"
share|improve this answer
This sort of worked, but only after I set Type to 'Application in Terminal'. For some reason it doesn't work if it's just Application. – sashoalm Jun 22 '11 at 18:41
@satuon Strange, maybe that's a MATLAB specific thing. – Alvin Row Jun 22 '11 at 19:03
@satuon: could you try using /bin/sh instead of sh? Perhaps it works then – Lekensteyn Jun 22 '11 at 19:27
@sashoalm (better late than never) you need to specify the option -desktop if you dont want to run it from terminal. – aiao Apr 26 '15 at 18:20

Your Answer


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.