elenapan/config/awesome/noodle/mpd_song.lua
elenapan c738169ca5 New theme: ephemeral, anti-aliased corners, app drawer, lock screen,
evil daemon system, dependency list update, README improvements.


Former-commit-id: db310f8e49
Former-commit-id: 4f25f9200c3ac9f9385daca5a68378249ff0329e
Former-commit-id: 69fa3954e5738446a59b409b7e326233e7c3ef55
Former-commit-id: 673176f7857e39f3455f4ccb426eef2789c0e891
2019-08-01 02:17:59 +03:00

54 lines
1.3 KiB
Lua

local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful")
-- Set colors
local title_color = beautiful.mpd_song_title_color or beautiful.wibar_fg
local artist_color = beautiful.mpd_song_artist_color or beautiful.wibar_fg
local paused_color = beautiful.mpd_song_paused_color or beautiful.normal_fg
local mpd_title = wibox.widget{
text = "---------",
align = "center",
valign = "center",
widget = wibox.widget.textbox
}
local mpd_artist = wibox.widget{
text = "---------",
align = "center",
valign = "center",
widget = wibox.widget.textbox
}
-- Main widget
local mpd_song = wibox.widget{
mpd_title,
mpd_artist,
layout = wibox.layout.fixed.vertical
}
local artist_fg
local artist_bg
awesome.connect_signal("evil::mpd", function(artist, title, status)
if status == "paused" then
artist_fg = paused_color
title_fg = paused_color
else
artist_fg = artist_color
title_fg = title_color
end
-- Escape &'s
title = string.gsub(title, "&", "&")
artist = string.gsub(artist, "&", "&")
mpd_title.markup =
"<span foreground='" .. title_fg .."'>"
.. title .. "</span>"
mpd_artist.markup =
"<span foreground='" .. artist_fg .."'>"
.. artist .. "</span>"
end)
return mpd_song