]> git.rmz.io Git - dotfiles.git/commitdiff
awesome: support widget for missing title and file
authorSamir Benmendil <me@rmz.io>
Mon, 22 Aug 2022 10:36:17 +0000 (11:36 +0100)
committerSamir Benmendil <me@rmz.io>
Mon, 22 Aug 2022 10:36:17 +0000 (11:36 +0100)
This could happen when listening to a stream for example.

awesome/widgets/mpd_widget.lua

index 1d011cf5cde5b2b80bee0365e84622efae4d3ae4..9a698f76cabf62784b304152a535768c0a7934d7 100644 (file)
@@ -26,10 +26,12 @@ function widget:update_widget()
     local artist = self._currentsong.artist
     local title = self._currentsong.title
     local file = self._currentsong.file
-    if not artist then
+    if artist and title then
+        text = string.format("%s - %s", artist, title)
+    elseif title or file then
         text = string.format("%s", title or file )
     else
-        text = string.format("%s - %s", artist, title)
+        text = "-"
     end
     self._textbox.text = text
 end