Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I create a menu item that points to a URL?

I've tried creating a mylink.desktop entry like this:

[Desktop Entry]
Name=My Link Name

then using xdg-desktop-menu install mylink.desktop should put this entry in the current user's menu. This does not work however. The file is copied into ~/.local/share/applications/ but the entry doesn't show up in the menu.

If I change Type to Application and define Exec instead of URL then it works. But I don't want to have menu entry for a local application. I want a default browser to launch on a specified address when the menu entry is selected.

How can I do that?

Also, by using this command: xdg-desktop-icon install mylink.desktop the result is as expected - a new link is created on the desktop. So why doesn't it work in the menu?

I tested this on RedHat Enterprise Linux 6 with KDE, but I would like to know how to do it in Gnome as well.

share|improve this question
I Assume you mean RedHat Enterprise 6 (RHEL 6) or perhaps even Fedora 6, but RedHat 6 itself is 10 years old now and a bit obsolete. – penguin359 Apr 28 '11 at 10:25
@penguin oh yeah, I meant RHEL 6, sorry ;) – Fiktik Apr 28 '11 at 10:35
up vote 2 down vote accepted

While reading up on stuff I stumbled uppon this question. That gave me an idea for a workaround:

[Desktop Entry]
Name=My Link Name
Exec=xdg-open http://www.example.com/

This does exactly what I need and is a local application, so I can use xdg-desktop-menu to install this entry without problems.

share|improve this answer

AFAIK, you need to create a Link.directory file in /usr/share/deskop-directory. And merge this directory into the proper menus [ by editing the /etc/xdg/applications.menu, I guess. Please check the exact menu file ]

share|improve this answer
You mean to create mylink.directory with the same contents as mylink.desktop above, but add it as a new menu directory? Would this really work? – Fiktik Apr 28 '11 at 8:57
no no. Not the mylink.directory but the Link.directory. [ here Link is value you write against the "Type" variable ] – SHW Apr 28 '11 at 9:09
OK, could you please be more specific? What should Link.directory contain? I suppose I could add it by invoking xdg-desktop-menu as well instead of manually editing /etc/xdg/menus/applications.menu, right? – Fiktik Apr 28 '11 at 10:45
satishwagh.blogspot.com/2010/05/… – SHW Apr 28 '11 at 11:19
this doesn't help me at all. I don't want to create any custom submenu... – Fiktik Apr 28 '11 at 11:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.