prompt: Make exe_callback optional

The menubar already bypass it using keypress listener. Having an
empty callback is ugly.

Fixes #1180
This commit is contained in:
Emmanuel Lepage Vallee 2016-12-11 14:19:25 -05:00
parent 81f8a3085e
commit 0e1c193450
2 changed files with 2 additions and 3 deletions

View File

@ -365,7 +365,7 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
local cur_pos = (selectall and 1) or text:wlen() + 1
-- The completion element to use on completion request.
local ncomp = 1
if not textbox or not (exe_callback or args.hooks) then
if not textbox then
return
end
@ -394,7 +394,7 @@ function prompt.run(args, textbox, exe_callback, completion_callback,
textbox:set_markup("")
history_add(history_path, command_to_history)
keygrabber.stop(grabber)
cb(command)
if cb then cb(command) end
if done_callback then done_callback() end
end

View File

@ -444,7 +444,6 @@ function menubar.show(scr)
awful.prompt.run(setmetatable({
prompt = "Run: ",
textbox = instance.prompt.widget,
exe_callback = function() end,
completion_callback = awful.completion.shell,
history_path = awful.util.get_cache_dir() .. "/history_menu",
done_callback = menubar.hide,