diff options
author | Romanos Skiadas <rom.skiad@gmail.com> | 2021-10-15 18:41:49 +0300 |
---|---|---|
committer | Romanos Skiadas <rom.skiad@gmail.com> | 2021-10-15 18:47:11 +0300 |
commit | ca085289269122da468dd123edb8cd4a0144dc59 (patch) | |
tree | 1e548df21d7f3ffee70cfbbe5e2967565200292e | |
parent | 567b5bb84fb0a572c30d72b09b3db195ca06a6bf (diff) |
mpris-widget: correct artUrl
Perhaps due to the regex change, or maybe it never did work, art was always
nil. Use gears.string.split(), which works, is much easier to read than the
regex and removes the need to munge the artUrl after too.
-rw-r--r-- | mpris-widget/init.lua | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/mpris-widget/init.lua b/mpris-widget/init.lua index 74bb74e..c9fa723 100644 --- a/mpris-widget/init.lua +++ b/mpris-widget/init.lua @@ -135,24 +135,20 @@ end local function worker() -- retrieve song info - local current_song, artist, player_status, art, artUrl + local current_song, artist, player_status, artUrl local update_graphic = function(widget, stdout, _, _, _) - local words = {} - for w in stdout:gmatch("([^;]*);") do table.insert(words, w) end - + local words = gears.string.split(stdout, ';') player_status = words[1] artist = words[2] current_song = words[3] - art = words[4] + artUrl = words[4] if current_song ~= nil then if string.len(current_song) > 18 then current_song = string.sub(current_song, 0, 9) .. ".." end end - if art ~= nil then artUrl = string.sub(art, 8, -1) end - if player_status == "Playing" then icon.image = PLAY_ICON_NAME widget.colors = {beautiful.widget_main_color} |