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 Oct 25 '15 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 Oct 25 '15 at 22:05
  • @lese, good point I actually realised %F was not required. Jodka Lemon's solution worked both with and without it. – castaway Oct 25 '15 at 23:20

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. – WinEunuuchs2Unix May 10 '20 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" – Mohit Atray Feb 16 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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