Would be nice to be shown the magic button that will help me remove this eyesore:
It's Nautilus 2.30 on Debian (and has been there in previous versions as far as I can remember).
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 filesbanshee-1-audiocd.desktop
: Audio CD'sbanshee-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.
If you look in ~/.local/share/applications
and /usr/share/applications
you can remove duplicates from those two places. That did it for me.
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.
You can also look in Gnome's "Applications" menu editor and remove duplicates from here.
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.
jhbuild.desktop
andmimeapps.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