I am finishing off a flatpak app and I’m working on the ‘.desktop’ file. I have managed to write lines in my flatpak yaml file that install the desktop and the img files on my system. Right now the desktop file looks like this:
Comment=A client for Gpt servers.
#Exec=/bin/bash -c "flatpak run org.theguy.GptEtc"
The app works and I can type ‘flatpak run org.theguy.GptEtc’ and it launches. If I use the run-launcher on my system, I can see the entry for ‘GptEtc’ and I can select it. No app opens up at that time.
I can, from the command line, type ‘gtk-launch org.theguy.GptEtc.desktop’ and I get the message below:
bwrap: execvp org.theguy.GptEtc: No such file or directory
If I switch the commenting on the Exec line, so that the ‘bash’ command is run, I get a message that flatpak cannot be found.
/bin/bash: line 1: flatpak: command not found
I can run ‘which flatpak’ and I see it on /usr/bin/flatpak.
How do I write the Exec line so that my flatpak app is run? Thanks for your time.
You put the binary you want to execute into Exec (I guess in your case Exec=run.sh). Flatpak will update the desktop file when the application is installed to run through flatpak.
I don’t know why the documentation uses the app-id. Either there is some app-id magic which doesn’t work, the Exec-line is simply wrong or just confusing (maybe there is an org.gnome.Dictionary binary?).
Hah, I dug through the Flatpak source, and found the logic where the desktop file is generated/transformed:
The old_exec part is guarded by an if. We cannot omit the Exec from the original desktop file entry (otherwise flatpak-builder complains), but if it’s empty (i.e. Exec=) then the generated desktop file does not contain a --command argument and simply delegates to the default command of the Flatpak.