By having a
#! line then the
.desktop file can be made executable and run directly (e.g. from a command line, or some file browsers).
The idea behind wrapping with
env is to handle different OS's where
xdg-open might be in different directories. For example, on Debian the program is in
/usr/bin/xdg-open but on another OS it might be elsewhere. The location of
env is pretty much fixed and this construct will effectively result in
$PATH being searched for the
On my Debian install no file in
/usr/share/applications is marked executable and none of them have a
So if you want your
.desktop file to be executable then you need a
#! and wrapping it with
env will help in portability. If you don't need it to be executable then you don't need it.