From 94856f48b48766ff8b4280d414835503f8044f40 Mon Sep 17 00:00:00 2001 From: Funtov Kirill Date: Wed, 4 Apr 2018 21:43:36 +0300 Subject: [PATCH 1/2] Allow use of custom completion callback in prompt widget --- lib/awful/widget/prompt.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/awful/widget/prompt.lua b/lib/awful/widget/prompt.lua index 680887dba..c7d29917c 100644 --- a/lib/awful/widget/prompt.lua +++ b/lib/awful/widget/prompt.lua @@ -38,7 +38,7 @@ local function run(promptbox) return prompt.run { prompt = promptbox.prompt, textbox = promptbox.widget, - completion_callback = completion.shell, + completion_callback = promptbox.completion_callback, history_path = gfs.get_cache_dir() .. "/history", exe_callback = function (...) promptbox:spawn_and_handle_error(...) @@ -59,6 +59,8 @@ end -- @tparam[opt="Run: "] string args.prompt Prompt text. -- @tparam[opt=`beautiful.prompt_bg` or `beautiful.bg_normal`] color args.bg Prompt background color. -- @tparam[opt=`beautiful.prompt_fg` or `beautiful.fg_normal`] color args.fg Prompt foreground color. +-- @tparam[opt=`awful.completion.shell`] function args.completion_callback +-- The callback function to call to get completion. -- @return An instance of prompt widget, inherits from `wibox.container.background`. -- @function awful.widget.prompt function widgetprompt.new(args) @@ -71,6 +73,7 @@ function widgetprompt.new(args) promptbox.prompt = args.prompt or "Run: " promptbox.fg = args.fg or beautiful.prompt_fg or beautiful.fg_normal promptbox.bg = args.bg or beautiful.prompt_bg or beautiful.bg_normal + promptbox.completion_callback = args.completion_callback or completion.shell return promptbox end From 38f7b17f0b0486d836036cf2f60f1d8afcdecb0a Mon Sep 17 00:00:00 2001 From: Kirill Funtov Date: Thu, 5 Apr 2018 11:04:17 +0300 Subject: [PATCH 2/2] Added link to awful.prompt.run to documentation --- lib/awful/widget/prompt.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/awful/widget/prompt.lua b/lib/awful/widget/prompt.lua index c7d29917c..8c12d1e1a 100644 --- a/lib/awful/widget/prompt.lua +++ b/lib/awful/widget/prompt.lua @@ -60,7 +60,7 @@ end -- @tparam[opt=`beautiful.prompt_bg` or `beautiful.bg_normal`] color args.bg Prompt background color. -- @tparam[opt=`beautiful.prompt_fg` or `beautiful.fg_normal`] color args.fg Prompt foreground color. -- @tparam[opt=`awful.completion.shell`] function args.completion_callback --- The callback function to call to get completion. +-- The callback function to call to get completion. See @{awful.prompt.run} for details. -- @return An instance of prompt widget, inherits from `wibox.container.background`. -- @function awful.widget.prompt function widgetprompt.new(args)