Update mpris plugin with cover art
This commit is contained in:
parent
8d5ee408cf
commit
0ff84042ab
5 changed files with 145 additions and 27 deletions
|
@ -5,6 +5,7 @@
|
|||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local color = require("src.theme.colors")
|
||||
local cat = require("src.theme.catppuccin")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local watch = awful.widget.watch
|
||||
|
@ -20,38 +21,38 @@ return function()
|
|||
local mpris_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
-- {
|
||||
-- {
|
||||
-- {
|
||||
-- id = "icon",
|
||||
-- widget = wibox.widget.imagebox,
|
||||
-- image = gears.color.recolor_image(icon_dir .. "cd.svg", color["Grey900"]),
|
||||
-- resize = false
|
||||
-- },
|
||||
-- id = "icon_layout",
|
||||
-- widget = wibox.container.place
|
||||
-- },
|
||||
-- top = dpi(2),
|
||||
-- widget = wibox.container.margin,
|
||||
-- id = "icon_margin"
|
||||
-- },
|
||||
-- spacing = dpi(10),
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = true
|
||||
},
|
||||
id = "icon_layout",
|
||||
clip_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 2)
|
||||
end,
|
||||
widget = wibox.container.place
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
id = "icon_margin"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
font = "UbuntuMono Nerd Font, Bold 8",
|
||||
align = "left",
|
||||
valign = "center",
|
||||
font = "UbuntuMono Nerd Font, Bold",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "mpris_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Orange200"],
|
||||
bg = cat["Lavender"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
|
@ -59,13 +60,22 @@ return function()
|
|||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
Hover_signal(mpris_widget, color["Orange200"], color["Grey900"])
|
||||
Hover_signal(mpris_widget, cat["Lavender"], color["Grey900"])
|
||||
|
||||
watch(
|
||||
[[ bash -c "$HOME/.config/awesome/bin/get_mpris_status_hide_album.sh" ]],
|
||||
[[ bash -c "$HOME/.config/awesome/bin/get_mpris_status.sh" ]],
|
||||
5,
|
||||
function(_, stdout)
|
||||
mpris_widget.container.mpris_layout.label.text = stdout:gsub("\n", "")
|
||||
mpris_widget.container.mpris_layout.label.text = stdout
|
||||
awesome.emit_signal("update::mpris_widget", tostring(stdout))
|
||||
end
|
||||
)
|
||||
|
||||
watch(
|
||||
[[ bash -c "$HOME/.config/awesome/bin/get_mpris_art.sh" ]],
|
||||
5,
|
||||
function(_, stdout)
|
||||
mpris_widget.container.mpris_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(stdout:gsub("\n", ""):gsub("file://", "")))
|
||||
awesome.emit_signal("update::mpris_widget", tostring(stdout))
|
||||
end
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue