15

Would be nice to be shown the magic button that will help me remove this eyesore:

alt text

It's Nautilus 2.30 on Debian (and has been there in previous versions as far as I can remember).

sr_
  • 15,384
tshepang
  • 65,642

6 Answers6

9

This list gets created by analyzing .desktop files located at:

/usr/share/applications
~/.local/share/applications

There might be more than one usecase per application, take for example the media player banshee which has three .desktop files by default:

$ ls -1 /usr/share/applications/banshee*
/usr/share/applications/banshee-1-audiocd.desktop
/usr/share/applications/banshee-1.desktop
/usr/share/applications/banshee-1-media-player.desktop

The only difference between those files is the starting parameter and the MimeType list.

  • banshee-1.desktop: General media files
  • banshee-1-audiocd.desktop: Audio CD's
  • banshee-1-media-player.desktop Audio player (Also used by rhythmbox, vlc, and others)

So we have three 'Banshee Media Player' in the 'Open with' list (and maybe also in the 'Main Menu').

The other way of filling this space is by creating personal .desktop files in ~/.local/share/applications. Either manually or by using a tool. alacarte (or right-click on 'Main Menu' -> 'Edit Menu') is one of those.

Every time you create or move an application within alacarte, a new .desktop file gets placed inside ~/.local/share/applications. Disabling an application will "remove" it from the 'Main Menu', but not from the 'Open with' list.
But the 'Delete' button does, by creating a identical copy from /usr/share/applications into ~/.local/share/applications and adding Hidden=true to the .desktop file, thus "overwriting" the system-wide inherited values.

Deleting two of those entries from alacarte results in:

$ ls -1 ~/.local/share/applications/banshee*
/home/user/.local/share/applications/banshee-1-audiocd.desktop
/home/user/.local/share/applications/banshee-1-media-player.desktop

Removing any entries from ~/.local/share/applications will reverse to the preexisting state (three banshee items).

If you really don't have any duplicates in those two folders, try removing any duplicates from alacarte or playing with the Hidden=true option in the corresponding .desktop files.

wag
  • 35,944
  • 12
  • 67
  • 51
7

If you look in ~/.local/share/applications and /usr/share/applications you can remove duplicates from those two places. That did it for me.

Gert
  • 9,994
  • Note that I only have jhbuild.desktop and mimeapps.list in ~/.local/share/applications. And, there's no dupes in /usr/share/applications, and I'm still experiencing the problem. – tshepang Dec 17 '10 at 09:21
2

I know this thread is old, but this is caused by wine for many.

rm ~/.local/share/applications/wine-extension*

cleaned up this mess for me.

Mat
  • 52,586
1

Acknowledging this thread is old, I was perplexed by this issue myself. I personally felt deleting the files or playing "cleanup" was unecessary, as was just tweaking things for the current user. If there is more than 1 .desktop file, can't each have a unique description? As far as Linux has come, have certain app developers really overlooked simple things like this?

I found if you open the .desktop files in a text editor, the Name field is what displays in the "Open With" menu. So for me, I looked for the .desktop files I knew were creating the issue (for instance, the 3 Banshee files). Looking at each one, the difference almost always had to do with which mimetypes the shortcut is handling. This is because some programs prefer to pass different parameters depending on the mimetype. Only in 1 instance did I find duplicate entries the result of an application upgrade not cleaning up it's old .desktop file

Armed with that discovery, I changed the Name fields of the known duplicate entries to reflect this. For instance, editing the .desktop file Banshee has specifically to handle Audio CD's, I made the name read as such:

Banshee (Audio CD)

Rhythmbox is also a good example, as it has a separate .desktop file specifically for handling CD's + MP3 players but each shows up the same. My guess is the 1 file loads the application and puts focus on the unit rather than your library. This is worth renaming, then, as you wouldn't want this to happen when handling your MP3/OGG files.

Anyway, I think this makes the Open With menu look clean without just deleting files that appear to be useful. Whether or not these changes persists between application updates is yet to be seen...but they are simple and quick edits that could even be scripted. The shell helps tremendously in that case. For instance, to see all the filenames (with path) with such duplicate entries:

grep -rl "^Name=Banshee$" /usr/share/applications

Where "Banshee" is of course what shows up more than once in the Open With menu. In the example provided up top, the app was called Geany.

With this, you can send the resultant files straight to your editor. If you are not an expert in reg expressions, the ^ and $ specify beginning of line and end of line, respectively. This keeps the system from finding lines like XGnome-FullName=Banshee Media Player It also prevents it from finding entries you may have already fixed up.

0

You can also look in Gnome's "Applications" menu editor and remove duplicates from here.

  • Have you ever seen duplicates there? – tshepang Dec 15 '10 at 17:33
  • Yes. Some applications create duplicates which appears in the "open with" dialog like geany for you and I can remove them from here by editing gnome's Applications menu (in which they're present but hidden, so you don't see them by just browsing the menu, only in editor). – gentledevil Feb 08 '11 at 11:34
0

Kind of a shot in the dark, but have you tried clicking on one of the entries, and clicking the Remove button as seen in your screenshot? If this removes all of the entries, you could just re-add it.

jonescb
  • 1,918