]> git.rmz.io Git - dotfiles.git/commitdiff
awesome/mpd_widget: destroy notification immediately when delay is nil
authorSamir Benmendil <me@rmz.io>
Mon, 10 Aug 2020 20:31:41 +0000 (21:31 +0100)
committerSamir Benmendil <me@rmz.io>
Mon, 10 Aug 2020 21:05:30 +0000 (22:05 +0100)
awesome/widgets/mpd_widget.lua

index 2c6ab78ec3ce8888db1fbe4393a54de3a588958e..a0defc1de681c6bcd092f72f1e6bf53e27e682a9 100644 (file)
@@ -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