1

I'm trying to create a desktop file to any page but all of them open google. I'm using firefox in xubuntu 14.10.

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Link
Icon[es]=gnome-panel-launcher
Name[es]=askubuntu
URL=http://askubuntu.com/
Name=askubuntu
Icon=gnome-panel-launcher

2 Answers2

0

It might be simpler to use:

Type=Application
....
Exec=firefox "http://askubuntu.com"

instead of Type=Link & URL=https://askubuntu.com/. When I last tried using link launchers all kinds of weird stuff occured (opened most of the links in Chromium, Firefox new windows all rest of the time, etc)

An alternative to adding the #!/usr/bin/env xdg-open line to the top is to make the file executable using this command:

chmod +x "/PATH/TO/LAUNCHER.desktop"

or by making sure this is ticked in the file's properties (under 'permissions'):

Execute: Allow executing file as program

See also: Desktop launcher documentation?

Wilf
  • 30,732
0

The fact is, .desktop files are not scripts. You need to remove the #!/usr/bin/env xdg-open from the top of the file. You do not run them from a terminal either. If you want to open them from a terminal, you would run xdg-open askubuntu.desktop for example. You do need to ensure they are executable to open them from within Nautilus though, as it requires the executable bit to be able to use them as launchers, rather than opening them in the text editor.

dobey
  • 41,650