From 975eba004945c81ef2d8bce8d1903e9b37fa815d Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 17 Jun 2008 16:37:27 +0200 Subject: [PATCH] awful: simplify menu args Signed-off-by: Julien Danjou --- awesomerc.lua.in | 8 ++++++-- awful.lua | 7 +++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index c5151d38..ce120651 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -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 () diff --git a/awful.lua b/awful.lua index 1b48c89d..3d9cba31 100644 --- a/awful.lua +++ b/awful.lua @@ -461,9 +461,12 @@ local function menu_text_with_cursor(text, text_color, cursor_color, cursor_pos) return text_start .. "" .. char .. "" .. 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