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" })
|
mytextbox = widget.new({ type = "textbox", name = "mytextbox", align = "right" })
|
||||||
-- Set the default text in textbox
|
-- Set the default text in textbox
|
||||||
mytextbox:set("text", "<b><small> awesome " .. AWESOME_VERSION .. " </small></b>")
|
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
|
-- Create an iconbox widget
|
||||||
myiconbox = widget.new({ type = "iconbox", name = "myiconbox", align = "left" })
|
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(mytaglist)
|
||||||
mystatusbar[s]:widget_add(myiconbox)
|
mystatusbar[s]:widget_add(myiconbox)
|
||||||
mystatusbar[s]:widget_add(mytasklist)
|
mystatusbar[s]:widget_add(mytasklist)
|
||||||
mystatusbar[s]:widget_add(mymenubox)
|
mystatusbar[s]:widget_add(mypromptbox)
|
||||||
mystatusbar[s]:widget_add(mytextbox)
|
mystatusbar[s]:widget_add(mytextbox)
|
||||||
mystatusbar[s]:widget_add(mylayoutbox[s])
|
mystatusbar[s]:widget_add(mylayoutbox[s])
|
||||||
mystatusbar[s]:add(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 }, "space", function () awful.layout.inc(layouts, 1) end):add()
|
||||||
keybinding.new({ modkey, "Shift" }, "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 ()
|
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()
|
end):add()
|
||||||
keybinding.new({ modkey }, "F4", function ()
|
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()
|
end):add()
|
||||||
|
|
||||||
--- Tabulous, tab manipulation
|
--- Tabulous, tab manipulation
|
||||||
|
|
|
@ -36,10 +36,10 @@ setfenv(1, P)
|
||||||
|
|
||||||
P.hooks = {}
|
P.hooks = {}
|
||||||
P.myhooks = {}
|
P.myhooks = {}
|
||||||
P.menu = {}
|
P.prompt = {}
|
||||||
|
P.completion = {}
|
||||||
P.screen = {}
|
P.screen = {}
|
||||||
P.layout = {}
|
P.layout = {}
|
||||||
P.completion = {}
|
|
||||||
P.client = {}
|
P.client = {}
|
||||||
P.tag = {}
|
P.tag = {}
|
||||||
|
|
||||||
|
@ -579,12 +579,12 @@ function P.completion.bash(command, cur_pos, ncomp)
|
||||||
return str, cur_pos
|
return str, cur_pos
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Draw the text menu with a cursor.
|
--- Draw the prompt text with a cursor.
|
||||||
-- @param text The text.
|
-- @param text The text.
|
||||||
-- @param text_color The text color.
|
-- @param text_color The text color.
|
||||||
-- @param cursor_color The cursor color.
|
-- @param cursor_color The cursor color.
|
||||||
-- @param cursor_pos The cursor position.
|
-- @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
|
local char
|
||||||
if not text then text = "" end
|
if not text then text = "" end
|
||||||
if #text < cursor_pos then
|
if #text < cursor_pos then
|
||||||
|
@ -602,7 +602,7 @@ end
|
||||||
-- @param textbox The textbox to use for the prompt.
|
-- @param textbox The textbox to use for the prompt.
|
||||||
-- @param exe_callback The callback function to call with command as argument when finished.
|
-- @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.
|
-- @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
|
if not args then return end
|
||||||
local command = ""
|
local command = ""
|
||||||
local command_before_comp
|
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
|
if not textbox or not exe_callback then
|
||||||
return
|
return
|
||||||
end
|
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(
|
keygrabber.run(
|
||||||
function (mod, key)
|
function (mod, key)
|
||||||
local has_ctrl = false
|
local has_ctrl = false
|
||||||
|
@ -713,7 +713,7 @@ function P.menu(args, textbox, exe_callback, completion_callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Update textbox
|
-- 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
|
return true
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Reference in New Issue