Launching a qt5 app from a .desktop file

Hi. I am using the [Deprecated] Desktop App support - Qt5 page to build an app in my job, automaton-builder. All is working great, except for using the .desktop file to start the app

In my snapcraft.yaml file I use

apps:
  automaton-builder:
    plugs: [home,x11, unity7, gsettings, network, desktop, desktop-legacy]
    command: bin/desktop-launch automatonBuilder
    environment:
      # Use GTK3 cursor theme, icon theme and open/save file dialogs.
      QT_QPA_PLATFORMTHEME: gtk3

And the app starts ok. But in the desktop file, this doesn’t work:

[Desktop Entry]
Version=2.45
Type=Application
Name=AutomatonBuilder
GenericName=AutomatonBuilder
Exec=${SNAP}/bin/desktop-launch $SNAP/usr/bin/automatonBuilder
TryExec=automatonBuilder
MimeType=applications/khd
Icon=${SNAP}/meta/gui/automaton-builder.png
Terminal=false
Path=/usr/bin/
Categories=Utility;
StartupNotify=true

It always says “Desktop file didn’t specified Exec field”

I am missing something? Maybe the page (for qt5 apps) should have an example of a .desktop file

you want to call the command that ends up in /snap/bin from your desktop file, not replicate the command: entry from your snapcraft.yaml.

i.e. snapcraft.yaml:

name: barfoo
[...]
apps:
  foobar:
    command: $SNAP/bin/desktop-launch $SNAP/usr/bin/mycommand
[...]

and .desktop file:

[...]
Exec=barfoo.foobar
[...]
1 Like

OMG you are right! Very simple

I got confused since, as the developer, I first made the first command and the desktop was “was the same”.

I think your explanation should be in all the desktop integration pages. The gnome shell error was confusing since I did fill the Exec field and it was fill with a “working” command.

Thanks again.