From: Samir Benmendil Date: Mon, 10 Aug 2020 20:31:41 +0000 (+0100) Subject: awesome/mpd_widget: destroy notification immediately when delay is nil X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/b15de3b4638d2a6764e84c3a6b0ce36bfef81534 awesome/mpd_widget: destroy notification immediately when delay is nil --- 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