-- TODO: update to the new color format local qnative = require "quarrel.native" local qui = require "quarrel.ui" local qvars = require "quarrel.vars" local wibox = require "wibox" local default_text = "Nothing playing" local w_title = wibox.widget { widget = wibox.widget.textbox, text = "Nothing playing", } local w_artist = wibox.widget { widget = wibox.container.background, fg = qcolor.palette.dim.fg, { widget = wibox.widget.textbox, text = "", }, } local w_progress_bar = wibox.widget { widget = wibox.widget.progressbar, max_value = 0, value = 0, forced_height = qui.CHAR_HEIGHT / 2, forced_width = qvars.expanded_bar_size - (qui.BIG_PADDING + qui.BIG_PADDING * 2 + qui.PADDING * 2) - (qui.CHAR_HEIGHT / 1.25 + qui.PADDING) * 3, color = qcolor.palette.yellow, background_color = qcolor.palette.black, shape = qui.shape, } local music = wibox.widget(qui.styled { widget = wibox.container.background, { widget = wibox.container.margin, margins = qui.BIG_PADDING, { { { widget = wibox.container.background, bg = qcolor.palette.bg, shape = qui.shape, { widget = wibox.container.margin, margins = qui.PADDING, { { widget = wibox.container.constraint, width = qvars.expanded_bar_size - (qui.BIG_PADDING + qui.BIG_PADDING * 2 + qui.PADDING * 2), height = qui.CHAR_HEIGHT, { widget = wibox.container.scroll.horizontal, speed = 50, step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, w_title, }, }, { widget = wibox.container.constraint, width = qvars.expanded_bar_size - (qui.BIG_PADDING + qui.BIG_PADDING * 2 + qui.PADDING * 2), height = qui.CHAR_HEIGHT, { widget = wibox.container.scroll.horizontal, speed = 50, step_function = wibox.container.scroll.step_functions.waiting_nonlinear_back_and_forth, w_artist, }, }, layout = wibox.layout.fixed.vertical, }, }, }, nil, nil, layout = wibox.layout.align.horizontal, }, nil, { widget = wibox.container.background, bg = qcolor.palette.bg, shape = qui.shape, w_progress_bar, }, layout = wibox.layout.align.vertical, }, }, }) awesome.connect_signal("services::playerctl::metadata", function(title, artist, album_path) w_title.text = title ~= "" and qnative.util.decode_html(title) or default_text w_artist.widget.text = qnative.util.decode_html(artist) end) awesome.connect_signal("services::playerctl::position", function(position, length) w_progress_bar.value = position w_progress_bar.max_value = length end) awesome.connect_signal("services::playerctl::no_players", function() w_title.text = default_text w_artist.text = "" w_progress_bar.value = 0 w_progress_bar.max_value = 0 end) return music