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

In a .desktop file you can specify the Path key in a [Desktop Entry] so that the working directory will be that path when the Exec is launched. However, this key does not seem to work when launching items from Quicklist even though the Path key is set in the [Desktop Action] group. Am I doing something wrong or does Unity not support this yet?

If there's no way to do this, can I change the Exec key in some way to get the same effect?

EDIT: For testing purposes, here's an example little script ( that when run displays the current working path in a Gtk window. There's an example .desktop file that follows showing that when run normally through the Launcher it opens with the right path (/home/ian/Documents in my case). However, activating it through a quicklist, displays the user directory (/home/ian in my case) instead. Just make sure to put the script somewhere in your $PATH.

from gi.repository import Gtk
import os


win.connect('destroy', Gtk.main_quit)

And the .desktop file:

[Desktop Entry]
Name=Display Working Directory

[Desktop Action quicklist]
Name=QL Display WD
share|improve this question
The problem isn't executing the program, it's setting the working directory so that the program will find the correct libraries and icons it will need once running. I need this to be a general property so it will work with other people's programs that I don't have control over. If there was a prefix to add on the Exec line to mimic this behavior, that might work. – Ian B. Feb 2 '13 at 3:12
Submited a bug report to Unity about this: – Ian B. Feb 3 '13 at 0:20
FYI this will fix your issue:… – Treviño Aug 8 '13 at 12:54

1 Answer 1

up vote 1 down vote accepted

Ok, I found a way around that, since it seems that the quicklist ignores the path and other variables, we can create a script that changes the directory, then executes your program.

  1. Create a file called or title of your choice, In that file use the following text:

    cd /home/ian/Documents
  2. Mark the file as executable, Right-Click > Properties > Permissions > Allow this file to run as Program.

    Or in terminal:

    chmod +x 
  3. Place in the same location you have and change the Quicklist to:

    [Desktop Action quicklist]
    Name=QL Display WD

    This makes the quicklist first call a shell-script that changes the directory, then runs your program.

Solution #2

After looking around I think you can change the Exec line to this:

Exec=bash -c "cd /home/ian/Documents &&"

To pass a string through bash, that changes the directory then runs your program.

share|improve this answer
This won't work for me... I can't predict what application a user will need to run and generate custom scripts for them on the fly to put in a launcher. For personal use though, this would be just fine. – Ian B. Feb 3 '13 at 0:17
I think I found another workaround that would only use the launcher file, edited in to end of answer. – Mateo Feb 3 '13 at 1:16
Props to you for the best available answer. Hope Unity will support in future. – Ian B. Feb 27 '13 at 1:55

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.