awful: rename menu to prompt
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
4a318e99fb
commit
5d3d45f0cf
|
@ -91,7 +91,7 @@ mytasklist:set("text_focus", "<bg color='"..bg_focus.."'/> <span color='"..fg_fo
|
|||
mytextbox = widget.new({ type = "textbox", name = "mytextbox", align = "right" })
|
||||
-- Set the default text in textbox
|
||||
mytextbox:set("text", "<b><small> awesome " .. AWESOME_VERSION .. " </small></b>")
|
||||
mymenubox = widget.new({ type = "textbox", name = "mymenubox", align = "left" })
|
||||
mypromptbox = widget.new({ type = "textbox", name = "mypromptbox", align = "left" })
|
||||
|
||||
-- Create an iconbox widget
|
||||
myiconbox = widget.new({ type = "iconbox", name = "myiconbox", align = "left" })
|
||||
|
@ -121,7 +121,7 @@ for s = 1, screen.count() do
|
|||
mystatusbar[s]:widget_add(mytaglist)
|
||||
mystatusbar[s]:widget_add(myiconbox)
|
||||
mystatusbar[s]:widget_add(mytasklist)
|
||||
mystatusbar[s]:widget_add(mymenubox)
|
||||
mystatusbar[s]:widget_add(mypromptbox)
|
||||
mystatusbar[s]:widget_add(mytextbox)
|
||||
mystatusbar[s]:widget_add(mylayoutbox[s])
|
||||
mystatusbar[s]:add(s)
|
||||
|
@ -206,12 +206,12 @@ keybinding.new({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end
|
|||
keybinding.new({ modkey }, "space", function () awful.layout.inc(layouts, 1) end):add()
|
||||
keybinding.new({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end):add()
|
||||
|
||||
-- Menu
|
||||
-- Prompt
|
||||
keybinding.new({ modkey }, "F1", function ()
|
||||
awful.menu({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mymenubox, awful.spawn, awful.completion.bash)
|
||||
awful.prompt({ prompt = "Run: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.spawn, awful.completion.bash)
|
||||
end):add()
|
||||
keybinding.new({ modkey }, "F4", function ()
|
||||
awful.menu({ prompt = "Run Lua code: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mymenubox, awful.eval, awful.completion.bash)
|
||||
awful.prompt({ prompt = "Run Lua code: ", cursor_fg = fg_focus, cursor_bg = bg_focus }, mypromptbox, awful.eval, awful.prompt.bash)
|
||||
end):add()
|
||||
|
||||
--- Tabulous, tab manipulation
|
||||
|
|
|
@ -36,10 +36,10 @@ setfenv(1, P)
|
|||
|
||||
P.hooks = {}
|
||||
P.myhooks = {}
|
||||
P.menu = {}
|
||||
P.prompt = {}
|
||||
P.completion = {}
|
||||
P.screen = {}
|
||||
P.layout = {}
|
||||
P.completion = {}
|
||||
P.client = {}
|
||||
P.tag = {}
|
||||
|
||||
|
@ -579,12 +579,12 @@ function P.completion.bash(command, cur_pos, ncomp)
|
|||
return str, cur_pos
|
||||
end
|
||||
|
||||
--- Draw the text menu with a cursor.
|
||||
--- Draw the prompt text with a cursor.
|
||||
-- @param text The text.
|
||||
-- @param text_color The text color.
|
||||
-- @param cursor_color The cursor color.
|
||||
-- @param cursor_pos The cursor position.
|
||||
local function menu_text_with_cursor(text, text_color, cursor_color, cursor_pos)
|
||||
local function prompt_text_with_cursor(text, text_color, cursor_color, cursor_pos)
|
||||
local char
|
||||
if not text then text = "" end
|
||||
if #text < cursor_pos then
|
||||
|
@ -602,7 +602,7 @@ end
|
|||
-- @param textbox The textbox to use for the prompt.
|
||||
-- @param exe_callback The callback function to call with command as argument when finished.
|
||||
-- @param completion_callback The callback function to call to get completion.
|
||||
function P.menu(args, textbox, exe_callback, completion_callback)
|
||||
function P.prompt(args, textbox, exe_callback, completion_callback)
|
||||
if not args then return end
|
||||
local command = ""
|
||||
local command_before_comp
|
||||
|
@ -617,7 +617,7 @@ function P.menu(args, textbox, exe_callback, completion_callback)
|
|||
if not textbox or not exe_callback then
|
||||
return
|
||||
end
|
||||
textbox:set("text", prompt .. menu_text_with_cursor(text, inv_col, cur_col, cur_pos))
|
||||
textbox:set("text", prompt .. prompt_text_with_cursor(text, inv_col, cur_col, cur_pos))
|
||||
keygrabber.run(
|
||||
function (mod, key)
|
||||
local has_ctrl = false
|
||||
|
@ -713,7 +713,7 @@ function P.menu(args, textbox, exe_callback, completion_callback)
|
|||
end
|
||||
|
||||
-- Update textbox
|
||||
textbox:set("text", prompt .. menu_text_with_cursor(command, inv_col, cur_col, cur_pos))
|
||||
textbox:set("text", prompt .. prompt_text_with_cursor(command, inv_col, cur_col, cur_pos))
|
||||
|
||||
return true
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue