Desktop Menu

XDG Desktop Menu specification

xdg.Menu.parse(filename=None, debug=False)[source]

Helper function. Equivalent to calling xdg.Menu.XMLMenuBuilder().parse(filename)

class xdg.Menu.Menu[source]

Menu containing sub menus under menu.Entries

Contains both Menu and MenuEntry items.

getComment()[source]

Returns the menu’s comment text.

getEntries(show_hidden=False)[source]

Interator for a list of Entries visible to the user.

getGenericName()[source]

Returns the menu’s generic name.

getIcon()[source]

Returns the menu’s icon, filename or simple name

getMenu(path)[source]

Searches for a Menu with a given path.

getMenuEntry(desktopfileid, deep=False)[source]

Searches for a MenuEntry with a given DesktopFileID.

getName()[source]

Returns the menu’s localised name.

getPath(org=False, toplevel=False)[source]

Returns this menu’s path in the menu structure.

class xdg.Menu.MenuEntry(filename, dir='', prefix='')[source]

Wrapper for ‘Menu Style’ Desktop Entries

DesktopEntry

The xdg.DesktopEntry.DesktopEntry instance holding the data for this entry.

getDir()[source]

Return the directory containing the desktop entry file.

getType()[source]

Return the type of MenuEntry, System/User/Both

save()[source]

Save any changes to the desktop entry.