awful.menu: add support for functions
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
25bf12868a
commit
8824d9f703
|
@ -100,21 +100,20 @@ mytextbox.text = "<b><small> " .. AWESOME_RELEASE .. " </small></b>"
|
||||||
|
|
||||||
-- Create a laucher widget and a main menu
|
-- Create a laucher widget and a main menu
|
||||||
myawesomemenu = {
|
myawesomemenu = {
|
||||||
{"manual", terminal .. " -e man awesome"},
|
{"manual", terminal .. " -e man awesome" },
|
||||||
{"edit config", terminal .. " -e nano ~/.config/awesome/rc.lua"},
|
{"edit config", terminal .. " -e " .. os.getenv("EDITOR") .. " ~/.config/awesome/rc.lua" },
|
||||||
{"restart", "echo \"awesome.restart()\" | awesome-client"},
|
{"restart", awesome.restart },
|
||||||
{"quit", "echo \"awesome.quit()\" | awesome-client"}
|
{"quit", awesome.quit }
|
||||||
}
|
}
|
||||||
|
|
||||||
mymainmenu = {
|
mymainmenu = {
|
||||||
{"awesome", myawesomemenu, "@AWESOME_ICON_PATH@/awesome16.png" },
|
{"awesome", myawesomemenu, "@AWESOME_ICON_PATH@/awesome16.png" },
|
||||||
{"open terminal", terminal}
|
{"open terminal", terminal }
|
||||||
}
|
}
|
||||||
|
|
||||||
mylauncher = awful.widget.launcher({ name = "mylauncher",
|
mylauncher = awful.widget.launcher({ name = "mylauncher",
|
||||||
image = "@AWESOME_ICON_PATH@/awesome16.png",
|
image = "@AWESOME_ICON_PATH@/awesome16.png",
|
||||||
menu = {"mymainmenu", mymainmenu}
|
menu = { "mymainmenu", mymainmenu } })
|
||||||
})
|
|
||||||
|
|
||||||
-- Create a systray
|
-- Create a systray
|
||||||
mysystray = widget({ type = "systray", name = "mysystray", align = "right" })
|
mysystray = widget({ type = "systray", name = "mysystray", align = "right" })
|
||||||
|
|
|
@ -92,6 +92,8 @@ local function exec(data, action, num)
|
||||||
elseif type(action[2]) == "string" then
|
elseif type(action[2]) == "string" then
|
||||||
destroy(get_parents(data))
|
destroy(get_parents(data))
|
||||||
util.spawn(action[2])
|
util.spawn(action[2])
|
||||||
|
elseif type(action[2]) == "function" then
|
||||||
|
action[2]()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue