awful: simplify menu args

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-17 16:37:27 +02:00
parent 66258a6d23
commit 975eba0049
2 changed files with 11 additions and 4 deletions

View File

@ -206,8 +206,12 @@ keybinding.new({ modkey }, "space", function () awful.layout.inc(layouts, 1) end
keybinding.new({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
-- Menu
keybinding.new({ modkey }, "F1", function () awful.menu("Run: ", mymenubox, fg_focus, bg_focus, awful.spawn) end):add()
keybinding.new({ modkey }, "F4", function () awful.menu("Run Lua code: ", mymenubox, fg_focus, bg_focus, awful.eval) end):add()
keybinding.new({ modkey }, "F1", function ()
awful.menu({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mymenubox, awful.spawn)
end):add()
keybinding.new({ modkey }, "F4", function ()
awful.menu({ prompt = "Run Lua code: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mymenubox, awful.eval)
end):add()
--- Tabulous, tab manipulation
keybinding.new({ modkey, "Control" }, "y", function ()

View File

@ -461,9 +461,12 @@ local function menu_text_with_cursor(text, text_color, cursor_color, cursor_pos)
return text_start .. "<span background=\"" .. cursor_color .. "\" foreground=\"" .. text_color .. "\">" .. char .. "</span>" .. text_end
end
local function menu(p, textbox, inv_col, cur_col, exe_callback)
local function menu(args, textbox, exe_callback)
if not args then return end
local command = ""
local prompt = p or ""
local prompt = args.prompt or ""
local inv_col = args.cursor_fg or "black"
local cur_col = args.cursor_bg or "white"
local cur_pos = 1
if not textbox or not exe_callback then
return