When launching an application through the command line I successfully use:

gourmet --gourmet-directory $HOME/my/custom/path/

But it does not work when trying to replicate this behaviour on a .desktop file with:

Exec=gourmet --gourmet-directory $HOME/my/custom/path/ %F 

I am probably missing something very basic here, but I cannot get my head around this. Any help would be much appreciated.

  • Can you clarify why you are using %F ? should the application open a list of files or it is just an application launcher, then you can open the files from the GUI
    – lese
    Commented Oct 25, 2015 at 21:57
  • 1
    You can make separate script-file with full command like gourmet --gourmet-directory $HOME/my/custom/path/ than put into .desktop full path to the script.
    – Costas
    Commented Oct 25, 2015 at 22:05
  • @lese, good point I actually realised %F was not required. Jodka Lemon's solution worked both with and without it.
    – castaway
    Commented Oct 25, 2015 at 23:20

1 Answer 1


Only command line options with one hyphen are possible in the Exec field.

Exec=sh -c "gourmet --gourmet-directory $HOME/my/custom/path/ %F"

should work.

  • Just tried today and -g=4536+76 and --geometry=4536+76 both worked equally well as arguments in .desktop exec line with or without sh -c wrapper in Ubuntu 16.04.6 LTS Unity Desktop. Commented May 10, 2020 at 15:34
  • Wrapping command in sh -c worked. I wanted to execute this sudo rogauracore initialize_keyboard; sudo rogauracore black. I executed it this way -- Exec=sh -c "sudo rogauracore initialize_keyboard; sudo rogauracore black" Commented Feb 16, 2021 at 12:13
  • 1
    Found this answer while searching for a solution to this problem - thanks @Jodka Lemon. But ... does anyone know why this restriction was created? Commented Apr 28, 2021 at 2:28
  • 4
    It doesn't seems to be true anymore, as the Desktop Specification (specifications.freedesktop.org/desktop-entry-spec/…) uses "Exec" examples with two hyphens. If it's not working at your distro, consider opening a Bug Report. Commented Aug 2, 2022 at 11:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .