From 07f3a178fa3de7dc0de0b5c39661dcaf4ed75d0b Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 11 Oct 2016 18:20:42 -0400 Subject: [PATCH] prompt: Fix 2 deprecation warnings An oversaw in a previous commit introduced deprecation warnings on the default config. --- lib/awful/widget/prompt.lua | 16 +++++++++------- lib/menubar/init.lua | 20 +++++++++++--------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/awful/widget/prompt.lua b/lib/awful/widget/prompt.lua index 80200646f..ff9d90459 100644 --- a/lib/awful/widget/prompt.lua +++ b/lib/awful/widget/prompt.lua @@ -20,13 +20,15 @@ local widgetprompt = { mt = {} } -- -- @param promptbox The promptbox to run. local function run(promptbox) - return prompt.run({ prompt = promptbox.prompt }, - promptbox.widget, - function (...) - promptbox:spawn_and_handle_error(...) - end, - completion.shell, - util.get_cache_dir() .. "/history") + return prompt.run { + prompt = promptbox.prompt, + textbox = promptbox.widget, + completion_callback = completion.shell, + history_path = util.get_cache_dir() .. "/history", + exe_callback = function (...) + promptbox:spawn_and_handle_error(...) + end, + } end local function spawn_and_handle_error(self, ...) diff --git a/lib/menubar/init.lua b/lib/menubar/init.lua index 7358a19fd..10ad65c2d 100644 --- a/lib/menubar/init.lua +++ b/lib/menubar/init.lua @@ -440,15 +440,17 @@ function menubar.show(scr) menulist_update(nil, scr) local prompt_args = menubar.prompt_args or {} - prompt_args.prompt = "Run: " - awful.prompt.run(prompt_args, instance.prompt.widget, - function() end, -- exe_callback function set to do nothing - awful.completion.shell, -- completion_callback - awful.util.get_cache_dir() .. "/history_menu", - nil, - menubar.hide, function(query) menulist_update(query, scr) end, - prompt_keypressed_callback - ) + + awful.prompt.run(setmetatable({ + prompt = "Run: ", + textbox = instance.prompt.widget, + completion_callback = awful.completion.shell, + history_path = awful.util.get_cache_dir() .. "/history_menu", + done_callback = menubar.hide, + changed_callback = function(query) menulist_update(query, scr) end, + keypressed_callback = prompt_keypressed_callback + }, {__index=prompt_args})) + instance.wibox.visible = true end