From 0e1c19345093a44e6cfdf8860310d79d0eccd270 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 11 Dec 2016 14:19:25 -0500 Subject: [PATCH] prompt: Make exe_callback optional The menubar already bypass it using keypress listener. Having an empty callback is ugly. Fixes #1180 --- lib/awful/prompt.lua | 4 ++-- lib/menubar/init.lua | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/awful/prompt.lua b/lib/awful/prompt.lua index ead326ae..b1515aed 100644 --- a/lib/awful/prompt.lua +++ b/lib/awful/prompt.lua @@ -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 diff --git a/lib/menubar/init.lua b/lib/menubar/init.lua index e3e2dc60..10ad65c2 100644 --- a/lib/menubar/init.lua +++ b/lib/menubar/init.lua @@ -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,