From b15de3b4638d2a6764e84c3a6b0ce36bfef81534 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Mon, 10 Aug 2020 21:31:41 +0100 Subject: [PATCH] awesome/mpd_widget: destroy notification immediately when delay is nil --- awesome/widgets/mpd_widget.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/awesome/widgets/mpd_widget.lua b/awesome/widgets/mpd_widget.lua index 2c6ab78..a0defc1 100644 --- a/awesome/widgets/mpd_widget.lua +++ b/awesome/widgets/mpd_widget.lua @@ -90,6 +90,18 @@ function widget:popup_show() end function widget:popup_hide(delay) + local function destroy() + if self._hover then return end + if not self._notification then return end + naughty.destroy(self._notification) + self._notification = nil + end + + if not delay then + destroy() + return + end + if self._hide_timer and self._hide_timer.started then self._hide_timer:again() else @@ -97,12 +109,7 @@ function widget:popup_hide(delay) { timeout = delay , autostart = true , single_shot = true - , callback = function() - if self._hover then return end - if not self._notification then return end - naughty.destroy(self._notification) - self._notification = nil - end + , callback = destroy }) end end -- 2.48.1