Skip to content

Commit cc3e74e

Browse files
committed
show album year in the popup
1 parent 182f803 commit cc3e74e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mpris-widget/init.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function playerctl:cmd(cmd)
2929
end
3030

3131
function playerctl:watch(timeout, callback, widget)
32-
local cmd = self:cmd("-f '{{status}};{{xesam:artist}};{{xesam:title}};{{mpris:artUrl}};{{position}};{{mpris:length}};{{album}}' metadata")
32+
local cmd = self:cmd("-f '{{status}};{{xesam:artist}};{{xesam:title}};{{mpris:artUrl}};{{position}};{{mpris:length}};{{album}};{{xesam:contentCreated}}' metadata")
3333

3434
self.watch_params = {timeout = timeout, callback = callback, widget = widget}
3535

@@ -50,6 +50,7 @@ function playerctl:watch(timeout, callback, widget)
5050
position = position,
5151
length = length,
5252
album = words[7],
53+
year = string.sub(words[8], 0, 4),
5354
progress = progress,
5455
}
5556

@@ -238,14 +239,13 @@ local function worker(user_args)
238239
local metadata_widget = wibox.widget {
239240
widget = wibox.widget.textbox,
240241
font = font,
241-
forced_height = 100,
242242
forced_width = popup_width,
243243
}
244244

245245
local update_metadata = function(meta)
246246
artist_widget:set_text(meta.artist)
247247
title_widget:set_text(meta.current_song)
248-
metadata_widget:set_text(string.format('%s - %s (%s/%s)', meta.album, meta.current_song, duration(meta.position), duration(meta.length)))
248+
metadata_widget:set_text(string.format('%s (%s)\n%s (%s/%s)', meta.album, meta.year, meta.current_song, duration(meta.position), duration(meta.length)))
249249
progress_widget.value = meta.progress
250250

251251
-- poor man's urldecode

0 commit comments

Comments
 (0)