Skip to content
Luca CPZ edited this page Apr 13, 2021 · 11 revisions

A Freedesktop.org menu.

Awesome 4.x branch

Usage

mymainmenu = freedesktop.menu.build() -- this is an awful.menu

Input table

Variable Meaning Type Default
before Entries to put before the retrieved ones table empty table
after Entries to put after the retrieved ones table empty table
skip_items Entries not to be retrieved table empty table
sub_menu Set the generated menu in its own entry string or false false

Examples

Freedesktop entries only

mymainmenu = freedesktop.menu.build()

Freedesktop entries only

Integrated with default rc.lua

myawesomemenu = {
    { "hotkeys", function() return false, hotkeys_popup.show_help end },
    { "manual", terminal .. " -e man awesome" },
    { "edit config", string.format("%s -e %s %s", terminal, editor_cmd, awesome.conffile) },
    { "restart", awesome.restart },
    { "quit", function() awesome.quit() end }
}
mymainmenu = freedesktop.menu.build({
    before = {
        { "Awesome", myawesomemenu, beautiful.awesome_icon },
        -- other triads can be put here
    },
    after = {
        { "Open terminal", terminal },
        -- other triads can be put here
    }
})

Integrated in default rc.lua

Awesome 3.5.x branch

Usage

Just call build with no arguments to feed the items variable in your main awful.menu with your system applications. Examples:

-- freedesktop entries only
mymainmenu = awful.menu({ items = freedesktop.menu.build() })
-- integrated in default rc.lua definition
myawesomemenu = {
    { "hotkeys", function() return false, hotkeys_popup.show_help end },
    { "manual", terminal .. " -e man awesome" },
    { "edit config", string.format("%s -e %s %s", terminal, editor, awesome.conffile) },
    { "restart", awesome.restart },
    { "quit", function() awesome.quit() end }
}
mymainmenu = awful.menu({
    items = {
        { "awesome", myawesomemenu, beautiful.awesome_icon },
        { "applications", freedesktop.menu.build() },
        { "open terminal", terminal },
    }
})
Clone this wiki locally