Xdg-menu
xdg-menu is a tool that generates XDG Desktop Menus for the following window managers:
KDE, GNOME, Xfce and Enlightenment are already XDG compatible.
Installation
Install the archlinux-xdg-menu package.
Menu hierarchy
- Applications
- Accessibility
- Accessories
- Development
- Education
- Games
- Graphics
- Internet
- Multimedia
- Office
- Other
- Science
- System
Configuration
xdg_menu relies on three sets of information to generate menus: a root menu or in other words an XML menu template generally passed on the command line, information cached when it was last run, and a series of configuration files.
- You can find some XML menu templates in
/etc/xdg/menus
. - If altering the code in xdg_menu to change layout, make sure you delete everything in
~/.xdg_menu_cache
or you will spend hours trying to figure out why your changes to the perl script do not take. - You can find individual application configurations in
/usr/share/applications
.
Other configuration file directories can be found under /usr/share
. In most cases you will not need to touch these. However if you want to change how your menu is layed out you can alter the menu template for minor changes. Major changes require tweaking the actual xdg_menu perl script. If you find that applications do not appear or that they are called strange things, then you will need to look at the .desktop file in /usr/share/applications
. Check the desktop entry specification.
Adding desktop entries from other directories
By default, the Xdg-menu will be populated with applications which install their desktop entries to /usr/share/applications
. To add applications to the menu which install their desktop entry to a user folder such as ~/.local/share/applications
, edit the /etc/xdg/menus/arch-applications.menu
file and add an <AppDir>
tag for the relevant directory, see below:
/etc/xdg/menus/arch-applications.menu
<Menu> <Name>Applications</Name> <Directory>Arch-Applications.directory</Directory> <DefaultAppDirs/> '''<AppDir>/home/''username''/.local/share/applications</AppDir>''' <DefaultDirectoryDirs/> <DefaultMergeDirs/> ...
Usage
update-menus
update-menus updates WM's menus from XDG data and can be configured to do it automaticaly.
This is a script wrapper around xdg_menu that relies on
To use it, you need to install the archlinux-xdg-menu package (xdg_menu)
In , you have to select from a list of window managers for which the menu should be generated. Comments with # are allowed.
All generated menus are placed in . See wm-specific #Examples section of this page to get more information.
Examples
With xdg_menu
$ xdg_menu --format awesome --root-menu /etc/xdg/menus/arch-applications.menu > ~/.config/awesome/archmenu.lua
Then, edit your as shown below.
- Add a require statment for your new file.
- Add an entry to your object for your new menu which calls
xdg-menu
.
... xdg_menu = require("archmenu") ... ... mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, { "Applications", xdgmenu }, { "open terminal", terminal } } }) ...
With xdg_menu
$ xdg_menu --format icewm --fullmenu --root-menu /etc/xdg/menus/arch-applications.menu >> ~/.icewm/programs
With update-menus
- Uncomment icewm in .
- Run as root.
- Make a symlink to in .
With xdg_menu
$ xdg_menu --format fluxbox --root-menu /etc/xdg/menus/arch-applications.menu > ~/.fluxbox/my-menu
Change your menu file to include the generated menu.
For example, add this line:
[include] (my-menu)
With update-menus
- Uncomment fluxbox in .
- Run as root.
- Change your menu file to include generated menu.
For example, add this line:
[include] (/var/cache/xdg-menu/fluxbox/boxrc)
With xdg_menu
Generate menu with:
$ xdg_menu --format openbox3 --root-menu /etc/xdg/menus/arch-applications.menu > xdg-menu.xml
And manually add it into your . For example, put into and add:
<menu id="Applications" />
Into .
As a pipe menu
Using xdg_open as a pipe menu gives you the added benefit of having a menu that automatically updates when you install new applications.
Add the following somewhere inside your menu.xml between your root menu tags:
<menu id="applications" label="Applications" execute="xdg_menu --format openbox3-pipe --root-menu /etc/xdg/menus/arch-applications.menu" />
A very basic example:
With update-menus
- Uncomment openbox in .
- Run as root.
- Change your file to include generated menu.
For example, add following to root-menu:
<menu id="xdg-menu" label="XDG Menu" execute="cat /var/cache/xdg-menu/openbox/menu.xml"/>
With xdg_menu
Use:
$ xdg_menu --format twm --root-menu /etc/xdg/menus/arch-applications.menu >my-twm-menu
And add it into twmrc manually. In the case of twm derivatives with m4 preprocessing such as vtwm or ctwm it can be included by adding:
sinclude(`/PATH/TO/my-twm-menu')
To .
With update-menus
- Uncomment twm in .
- Add in a file applications menu (add it into
defops menu
):
"apps" f.menu "Applications"
- Run as root.
- Run
twm -f /var/cache/xdg-menu/twm/twmrc
.
With xdg_menu
Use:
$ xdg_menu --format WindowMaker --root-menu /etc/xdg/menus/arch-applications.menu >my-wm-menu
And add:
#include "my-wm-menu"
Into your WindowMaker menu file.
You can also use the WPrefs "Application Menu Definitions", and add the xdg command as a parameter in a "Generated Submenu" object.
With update-menus
- Uncomment WindowMaker in .
- Run as root.
- Add:
#include "/var/cache/xdg-menu/WindowMaker/wmrc"
Into your menu file.
With xdg_menu
Generate the menu:
$ xdg_menu --format fvwm2 --root-menu /etc/xdg/menus/arch-applications.menu >fvwm2-menu
And add it into the root menu:
With update-menus
- Uncomment fvwm2 in .
- Run as root.
- Change your file to include generated menu. For example:
AddToMenu MenuFvwmRoot "Root Menu" Title + "&0. XDG Menu" Popup xdg_menu
read /var/cache/xdg-menu/fvwm2/fvwm2rc
With xdg_menu
$ xdg_menu --format blackbox --root-menu /etc/xdg/menus/arch-applications.menu >my-menu
Change your menu file to include the generated menu.
For example, add this line:
[include] (my-menu)
With update-menus
- Uncomment blackbox in .
- Run as root.
- Change your menu file to include the generated menu.
For example, add this line:
[include] (/var/cache/xdg-menu/blackbox/boxrc)