How to remove duplicate entries in ‘Open With’ Nautilus dialogue

nautilus

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).

Best Answer

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.

Related Question