Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I am new to Linux. I installed kubuntu-desktop and xubuntu-desktop over the default Ubuntu 10.10.

I want to unclutter the menu, so that applications related to a particular desktop appear in menu only during their respective sessions. (i.e., No KDE and XFCE apps in menu during Ubuntu GNOME session. Similarly in KDE and XFCE sessions.)

How can this be done via command line? (I want to learn things the command-line way.)
Should I backup anything before I do this?

Extra Information:
I googled and found this and other solutions in forums, but these address only the KDE on GNOME scenario. Perhaps this can be modified to include XFCE as well, but since I am a newbie, I couldn't figure out how to do it.

I have also cross-posted at unix.stackexchange

Gracias! Thanks!

share|improve this question
I don't think you can do this and you must suffer a mixture. See and read the articles under "Playing Around" ,on the left, – arochester Nov 25 '10 at 14:19

The code to show something only in XFCE follows the same idea:


Here are all the "ShowOnlyIn" possibilities:

Unfortunately, as far as I know, the way XFCE stores it's .desktop files is the same as the way GNOME stores them, whereas KDE stores them in a separate folder (within /usr/share/applications). This is why the separation of KDE/GNOME, as described in the post you link to, is much easier to do en-mass.

All the files are stored in /usr/share/applications. The format of them is very simple, and you can copy any one of them to /home/you/.local/share/applications and it will override that menu entry for that user so you can more easily edit them without needing root privileges.

There is no simple way to separate XFCE apps from GNOME, especially since it's often a matter of opinion what you want to see. This also goes for KDE, since as long as you have the KDE libraries Dolphin, Konquorer, etc. will run in GNOME.

I suppose if you're intent on using the cmd line you could come up with some grep/sed junk to selectively find and replace text inside certain .desktop files, but I think the easiest way would be to copy the files you want to edit to ~/.local/share/applications so they don't get overwritten by updates and edit them by hand. Unless you've got a gazillion things installed it shouldn't be too difficult to cherry pick what you want.

As a side note, editing .desktop files is annoyingly difficult when using Nautilus. You either have to drag and drop them into a text editor, open them through the command line or write a Nautilus script that directs the file to a text editor. Other file managers do not suffer this problem, so I guess it's a bug. Also, a .desktop file has a different name when it's executable, which can also be confusing, since it's not the actual name of the file.

The menu works under the specification, which you can learn more about here:

EDIT: I forgot about this when I originally answered this question and it's a pretty significant caveat. This only works when using the correct panels/menus. For example, if you're using xfwm with the GNOME panel you will see the all the "ShowOnlyIn=GNOME" items and vice versa. Just thought I'd throw that in there for anyone this is not working for :)

share|improve this answer

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.