Duplicated icons with Gnome3 and XDG menus

I’ve been using Gnome3 on Debian SID for some time now and I’ve been always bothered by the overlay view showing duplicated application icons in low-res. I’ve learnt not everyone has this problem so I had to find out the reason.

Some forum posts recommended removing the contents of the ./local/share/applications/ directory but they would come up again. Some solved it by removing the packages apparently responsible of the duplication, menu-xdg and/or menu, but that wasn’t possible in my case without removing other important packages.

What’s happening is that menu-xdg provides menu methods in /etc/menu-methods/ that convert the Debian menu to a XDG menu. These methods get executed whenever the update-menus command is run, and when it’s run by a normal user it dumps all the Debian menu into ~/.local/share/applications/menu-xdg/, not just the contents of ~/.menu.

So you shouldn’t execute update-menus as a normal user, but if you or some script already did you can solve it with:
update-menus --remove

This will remove anything created by a previous run.

You can avoid this to happen accidentally. Removing the following line in /etc/menu-methods/xdg-desktop-entry-spec-apps will make update-menus a dummy command for normal users:
userprefix = ".local/share/applications/menu-xdg";

UPDATE: I’ve reported this problem as bug 696530. Gnome packagers have already reacted by dropping the menu-xdg dependency in python-xdg so now I can remove it and everything is well. New Wheezy installations shouldn’t even get it installed.