+function widget:get_info()
+ local status, song = self._status, self._currentsong
+ if not status.state then return nil end
+
+ local info = {}
+ info.title = status.state .. " " .. status.song .. "/" .. status.playlistlength .. " " .. song_duration(status.elapsed, status.duration)
+ if not song.artist then
+ info.text = string.format("%s", song.title or song.file)
+ else
+ info.text = string.format("%s - %s", song.artist, song.title)
+ end
+ if song.album then
+ info.text = info.text .. "\n" .. tostring(song.album or "")
+ end
+
+ return info
+end
+
+function widget:popup_show()
+ if self._notification then return end
+
+ local table = self:get_info()
+ if not table then return end
+
+ self._timer:start()
+ self._notification = naughty.notify(
+ { title = table.title
+ , icon = self:get_albumart()
+ , icon_size = 64
+ , text = table.text
+ , timeout = 0
+ , destroy = function() self._timer:stop(); self._notification = nil end
+ })
+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.timeout = delay
+ self._hide_timer:again()
+ else
+ self._hide_timer = timer(
+ { timeout = delay
+ , autostart = true
+ , single_shot = true
+ , callback = destroy
+ })
+ end
+end
+
+function widget:popup_update()
+ if not self._notification then return end
+ self._connection:send("status", function(_, status)
+ self._status = status
+ local table = self:get_info()
+ if not self._notification then return end
+ naughty.replace_text(self._notification, table.title, table.text)