XDG-DESKTOP-MENU(1)
π xdg-desktop-menu β bestie's guide to the manual π
okay so this is the manual page for xdg-desktop-menu, and it lives in the xdg-desktop-menu Manual section of your friendly neighbourhood man pages. it's the command line tool for (un)installing desktop menu items. let's get into it π
β¨ NAME β¨
xdg-desktop-menu β command line tool for (un)installing desktop menu items
πΈ SYNOPSIS πΈ
xdg-desktop-menu install [--noupdate] [--novendor] [--mode mode]
directory-file(s) desktop-file(s)
xdg-desktop-menu uninstall [--noupdate] [--mode mode] directory-file(s)
desktop-file(s)
xdg-desktop-menu forceupdate [--mode mode]
xdg-desktop-menu {--help | --manual | --version}
π« DESCRIPTION π«
so xdg-desktop-menu is the program you use to install new menu entries into your desktop's application menu. that's it, that's the job. π
and the application menu it's playing with works according to the XDG Desktop Menu Specification, which lives at http://www.freedesktop.org/wiki/Specifications/menu-spec β go read it if you're that kind of girl, no judgment π
π«Ά COMMANDS π«Ά
π install
Install one or more applications in a submenu of the desktop menu system. iconic behaviour honestly.
- desktop-file: a desktop file represents a single menu entry in the menu. Desktop files are defined by the freedesktop.org Desktop Entry Specification. The most important aspects of
*.desktopfiles are summarized below.
Menu entries can be added to the menu system in two different ways. They can either be added to a predefined submenu in the menu system based on one or more category keywords, or they can be added to a new submenu.
To add a menu entry to a predefined submenu the desktop file that represents the menu entry must have a Categories= entry that lists one or more keywords. The menu item will be included in an appropriate submenu based on the included keywords.
To add menu items to a new submenu the desktop-files must be preceded by a directory-file that describes the submenu. If multiple desktop-files are specified, all entries will be added to the same menu. If entries are installed to a menu that has been created with a previous call to xdg-desktop-menu the entries will be installed in addition to any already existing entries. (yes, it stacks. she's additive like that β¨)
- directory-file: the
*.directoryfile indicated by directory-file represents a submenu. The directory file provides the name and icon for a submenu. The name of the directory file is used to identify the submenu.
If multiple directory files are provided each file will represent a submenu within the menu that precedes it, creating a nested menu hierarchy (sub-sub-menus). The menu entries themselves will be added to the last submenu.
Directory files follow the syntax defined by the freedesktop.org Desktop Entry Specification.
π uninstall
Remove applications or submenus from the desktop menu system previously installed with xdg-desktop-menu install.
A submenu and the associated directory file is only removed when the submenu no longer contains any menu entries. so basically she won't leave until the room is empty πͺ
β forceupdate
Force an update of the menu system.
This command is only useful if the last call to xdg-desktop-menu included the --noupdate option.
π OPTIONS π
--noupdateβ Postpone updating the menu system. If multiple updates to the menu system are made in sequence this flag can be used to indicate that additional changes will follow and that it is not necessary to update the menu system right away. (queue it up, batch it later, main character efficiency π§)--novendorβ Normally,xdg-desktop-menuchecks to ensure that any*.directoryand*.desktopfiles to be installed has a vendor prefix. This option can be used to disable that check.
A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated with a dash ("-"). Companies and organizations are encouraged to use a word or phrase, preferably the organizations name, for which they hold a trademark as their vendor prefix. The purpose of the vendor prefix is to prevent name conflicts.
--mode modeβmodecan beuserorsystem. In user mode the file is (un)installed for the current user only. In system mode the file is (un)installed for all users on the system. Usually only root is allowed to install in system mode.
The default is to use system mode when called by root and to use user mode when called by a non-root user. (she reads the room automatically, no cap π)
--helpβ Show command synopsis.--manualβ Show this manual page.--versionβ Show the xdg-utils version information.
π¦ DESKTOP FILES π¦
An application item in the application menu is represented by a *.desktop file. A *.desktop file consists of a [Desktop Entry] header followed by several Key=Value lines. that's the whole lore tbh.
A *.desktop file can provide a name and description for an application in several different languages. This is done by adding a language code as used by LC_MESSAGES in square brackets behind the Key. This way one can specify different values for the same Key depending on the currently selected language. multilingual queen πβ¨
The following keys are often used:
Type=Applicationβ This is a mandatory field that indicates that the*.desktopfile describes an application launcher. mandatory, bestie, you can't skip it πName=Application Nameβ The name of the application. For exampleMozillaGenericName=Generic Nameβ A generic description of the application. For exampleWeb BrowserComment=Commentβ Optional field to specify a tooltip for the application. For exampleVisit websites on the InternetIcon=Icon Fileβ The icon to use for the application. This can either be an absolute path to an image file or an icon-name. If an icon-name is provided an image lookup by name is done in the user's current icon theme. Thexdg-icon-resourcecommand can be used to install image files into icon themes. The advantage of using an icon-name instead of an absolute path is that with an icon-name the application icon can be provided in several different sizes as well as in several differently themed styles.Exec=Command Lineβ The command line to start the application. If the application can open files the%fplaceholder should be specified. When a file is dropped on the application launcher the%fis replaced with the file path of the dropped file. If multiple files can be specified on the command line the%Fplaceholder should be used instead of%f. If the application is able to open URLs in addition to local files then%uor%Ucan be used instead of%for%F.Categories=Categoriesβ A list of categories separated by semi-colons. A category is a keyword that describes and classifies the application. By default applications are organized in the application menu based on category. When menu entries are explicitly assigned to a new submenu it is not necessary to list any categories.
When using categories it is recommended to include one of the following categories: AudioVideo, Development, Education, Game, Graphics, Network, Office, Settings, System, Utility.
See Appendix A of the XDG Desktop Menu Specification for information about additional categories: http://standards.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry
MimeType=Mimetypesβ A list of mimetypes separated by semi-colons. This field is used to indicate which file types the application is able to open.
For a complete overview of the *.desktop file format please visit http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec
π DIRECTORY FILES π
The appearance of submenu in the application menu is provided by a *.directory file. In particular it provides the title of the submenu and a possible icon. A *.directory file consists of a [Desktop Entry] header followed by several Key=Value lines.
A *.directory file can provide a title (name) for the submenu in several different languages. This is done by adding a language code as used by LC_MESSAGES in square brackets behind the Key. This way one can specify different values for the same Key depending on the currently selected language.
The following keys are relevant for submenus:
Type=Directoryβ This is a mandatory field that indicates that the*.directoryfile describes a submenu. (mandatory again, don't test her π)Name=Menu Nameβ The title of submenu. For exampleMozillaComment=Commentβ Optional field to specify a tooltip for the submenu.Icon=Icon Fileβ The icon to use for the submenu. This can either be an absolute path to an image file or an icon-name. If an icon-name is provided an image lookup by name is done in the user's current icon theme. Thexdg-icon-resourcecommand can be used to install image files into icon themes. The advantage of using an icon-name instead of an absolute path is that with an icon-name the submenu icon can be provided in several different sizes as well as in several differently themed styles.
π ENVIRONMENT VARIABLES π
xdg-desktop-menu honours the following environment variables:
XDG_UTILS_DEBUG_LEVELβ Setting this environment variable to a non-zero numerical value makesxdg-desktop-menudo more verbose reporting on stderr. Setting a higher value increases the verbosity. (turn the volume knob up π)XDG_UTILS_INSTALL_MODEβ This environment variable can be used by the user or administrator to override the installation mode. Valid values areuserandsystem.
π EXIT CODES π
An exit code of 0 indicates success while a non-zero exit code indicates failure. The following failure codes can be returned:
- Error in command line syntax.
- One of the files passed on the command line did not exist.
- A required tool could not be found.
- The action failed.
- No permission to read one of the files passed on the command line.
π₯ SEE ALSO π₯
xdg-desktop-icon(1), xdg-icon-resource(1), xdg-mime(1), Desktop entry specification[1], Desktop menu specification[2]
π EXAMPLES π
Okay bestie, storytime πβ¨ β real-world scenarios, the whole vibe, let's go.
Example numero uno: one app, one .desktop file
So the company ShinyThings Inc. built an app called "WebMirror" and they wanna see it in the application menu. Iconic. Their vendor id is gonna be shinythings. To get it in the menu, you need a .desktop file with a suitable Categories entry:
shinythings-webmirror.desktop:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=webmirror
Icon=webmirror
Name=WebMirror
Name[nl]=WebSpiegel
Categories=Network;WebDevelopment;
Then you just point xdg-desktop-menu at it and slay:
xdg-desktop-menu install ./shinythings-webmirror.desktop
Quick note π«Ά for this example the menu items exist in two languages, English and Dutch. The language code for Dutch is nl. You're welcome, multilingual queen π
Example dos: the company gets its own submenu
Next up, ShinyThings Inc. decides they want their own submenu in the desktop application menu, made of a "WebMirror" menu item plus a "WebMirror Admin Tool" menu item. Main character energy fr fr π
First they gotta make two .desktop files describing those two items. And since these are going into a brand new submenu, there's no need to include a Categories= line. Convenient!
shinythings-webmirror.desktop:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=webmirror
Icon=shinythings-webmirror
Name=WebMirror
Name[nl]=WebSpiegel
shinythings-webmirror-admin.desktop:
[Desktop Entry]
Encoding=UTF-8
Type=Application
Exec=webmirror-admintool
Icon=shinythings-webmirror-admintool
Name=WebMirror Admin Tool
Name[nl]=WebSpiegel Administratie Tool
And on top of that, you need a .directory file to give the submenu itself a title and an icon πΈ:
shinythings-webmirror.directory:
[Desktop Entry]
Encoding=UTF-8
Icon=shinythings-webmirror-menu
Name=WebMirror
Name[nl]=WebSpiegel
Now these files can all be installed like this:
xdg-desktop-menu install ./shinythings-webmirror.directory \
./shinythings-webmirror.desktop ./shinythings-webmirror-admin.desktop
You could also install the menu entries one at a time, no judgement:
xdg-desktop-menu install --noupdate ./shinythings-webmirror.directory \
./shinythings-webmirror.desktop
xdg-desktop-menu install --noupdate ./shinythings-webmirror.directory \
./shinythings-webmirror-admin.desktop
xdg-desktop-menu forceupdate
The end result is literally the same either way, but installing all the files at once is slightly more efficient. Just saying ππ
And the icons?? Don't forget the icons!! π¦
The *.desktop and *.directory files reference icons by the names webmirror, webmirror-admin and webmirror-menu, and those suckers should be installed too. In this example the icons get installed in two different sizes β one at 22x22 pixels and one at 64x64 pixels:
xdg-icon-resource install --size 22 ./wmicon-22.png shinythings-webmirror
xdg-icon-resource install --size 22 ./wmicon-menu-22.png shinythings-webmirror-menu
xdg-icon-resource install --size 22 ./wmicon-admin-22.png shinythings-webmirror-admin
xdg-icon-resource install --size 64 ./wmicon-64.png shinythings-webmirror
xdg-icon-resource install --size 64 ./wmicon-menu-64.png shinythings-webmirror-menu
xdg-icon-resource install --size 64 ./wmicon-admin-64.png shinythings-webmirror-admin
β¨ AUTHORS β¨
- Kevin Krammer β Author. π«Ά
- Jeremy White β Author. π«Ά
π COPYRIGHT π
Copyright Β© 2006
π NOTES π
- Desktop entry specification
http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/ - Desktop menu specification
http://www.freedesktop.org/wiki/Specifications/menu-spec/
And that's a wrap, bestie!! π This whole page is from xdg-utils 1.0, dated 12/06/2025, and it lives at XDG-DESKTOP-MENU(1). Go forth and populate those menus, you absolute icon ππΈβ¨
π¦ where this page comes from
- arch rolling: xdg-utils 1.2.1-2 Β· MIT
- ubuntu resolute: xdg-utils 1.2.1-2ubuntu2 Β· MIT
- ubuntu stonking: xdg-utils 1.2.1-2ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms