I'd like to be able to add a #!
comment at the top of my .desktop
file so that if it has execute permissions and is executed, it'll actually run. However, I don't know what the interpreter for .desktop
files is, so I don't know which /usr/bin/
file to write in the hashbang. Any ideas?
Edit:
So far, I've made a small bash script, execdesktop
, that can execute desktop files:
`sed -nr 's/Exec=(.*)$/\\1/p' $1`
If I then add the following to my .desktop
files:
#!/usr/bin/execdesktop
Then it runs fine. This method works, but I'd prefer not to have to use it since it requires the installation of execdesktop.
You can always use xdg-open
for your shebang, as in:
#!/usr/bin/env xdg-open
This won't cause any trouble because #
starts comments also in .desktop
files.