diff --git a/lib/awful/keygrabber.lua b/lib/awful/keygrabber.lua index 08ccf032..8cb1f5d7 100644 --- a/lib/awful/keygrabber.lua +++ b/lib/awful/keygrabber.lua @@ -474,12 +474,20 @@ function keygrabber:start() end --- Stop the keygrabber. +-- +-- Also stops any `timeout`. +-- -- @method stop -- @emits stopped -- @emits property::current_instance function keygrabber:stop(_stop_key, _stop_mods) -- (at)function disables ldoc params keygrab.stop(self.grabber) + local timer = self._private.timer + if timer and timer.started then + timer:stop() + end + if self.stop_callback then self.stop_callback( self.current_instance, _stop_key, _stop_mods, self.sequence diff --git a/lib/gears/timer.lua b/lib/gears/timer.lua index ee1778d7..c2f2f99e 100644 --- a/lib/gears/timer.lua +++ b/lib/gears/timer.lua @@ -99,11 +99,13 @@ function timer:start() end --- Stop the timer. +-- +-- Does nothing if the timer isn't running. +-- -- @method stop -- @emits stop function timer:stop() if self.data.source_id == nil then - gdebug.print_error(traceback("timer not started")) return end glib.source_remove(self.data.source_id)