I have created a simple .desktop file to launch an Electron app I am building.

This should work, but launching from the .desktop doesn't seem to do anything. Other .desktop launchers seem to work.

#!/usr/bin/env xdg-open

[Desktop Entry]
Name[en_CA]=HD Notes
Comment[en_CA]=Launch HD Notes
Name=HD Notes
Comment=Launch HD Notes

As you can see, all this is supposed to do is run a .sh file that will actually launch the app.

hdnotes.sh contains the following:

(cd /home/harmonic/Work/HDNotes/ && exec electron .)

Running that command directly in the terminal works, so why does it not exec when using the .desktop file?

Even stranger, running

 `grep '^Exec' "HD Notes.desktop" | tail -1 | sed 's/^Exec=//' | sed 's/%.//' | sed 's/^"//g' | sed 's/" *$//g'` &

as per this answer on how to run a .desktop using the terminal DOES in fact work!

Does anyone have any insight on what is happening here? Not sure if this is a weird electron glitch or maybe a problem with Gnome.

  • The .desktop file is not a shell script, so those first two lines should not exist in the file. Remove them perhaps? – dobey Dec 5 '17 at 18:34

In Ubuntu 17, just use the lowercase in the following statement:


instead of


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.