0

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]
Version=1.0
Type=Application
Terminal=false
Icon[en_CA]=/home/harmonic/Work/HDNotes/icon.png
Name[en_CA]=HD Notes
Comment[en_CA]=Launch HD Notes
Exec=/home/harmonic/Documents/hdnotes.sh
Name=HD Notes
Comment=Launch HD Notes
Icon=/home/harmonic/Work/HDMail/icon.png

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:

#!/bin/sh
(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.

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

1 Answers1

1

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

Type=application

instead of

Type=Application