The system and standard in place for handling menu items in Unix based desktop
environments and window managers is a handy one developed by the fine folks at
Freedesktop.org. If you look under
/usr/share/applications in Linux and
/usr/local/share/applications in FreeBSD and OpenBSD, you’ll find a bunch
.desktop files. These are essentially what make up the applications that
populate menus. Whether that’s a menu under GNOME, MATE, XFCE, or any
number of standalone window managers.
Most desktop environments provide their own menu editor which makes it easy to modify menu items beyond just hiding them but this article isn’t going to cover other modifcations – just disabling unnecessary items to streamline your menu.
The Good Part
When you disable menu items using a desktop environment’s menu editor, this is what appears to happen behind the scenes (at least for me using MenuLibre):
- The item’s
.desktopfile gets copied to
NoDisplay=truegets added to the file
As an example here’s what my
file looks like:
[Desktop Entry] Version=1.1 Type=Application Name=UXTerm NoDisplay=true Comment=xterm wrapper for Unicode environments Icon=mini.xterm Exec=uxterm Actions= Categories=System;TerminalEmulator; Keywords=shell;prompt;command;commandline;cmd;
Editing this file and commenting out
NoDisplay=true or deleting this line
entirely will predictably have this item show up under my menu in XFCE.
First you’ll want to find a menu item you want hidden from your menu so for me
I’ll use the example above. It turns out you don’t have to do what menu editors
do by copying the file over to
~/.local/share/applications and appending
NoDisplay=true to it, it’s even simpler than that so sit tight:
$ touch ~/.local/share/applications/debian-uxterm.desktop
Seriously – that’s it. Deleting this file will have it show up in the menu
again. All you really need to do to disable menu items is find out what a
.desktop file is under
touch command to recreate it under
which creates an empty file and subsequently hides it from your menu.
So… That’s It?
Yeah, seriously – that’s it.