Fixed mpc volume and title

master
mark 2023-09-02 18:26:22 -07:00
parent 187ebbadb6
commit 73881d7d05
3 changed files with 26 additions and 8 deletions

View File

@ -31,7 +31,7 @@ for k, l in pairs(config.ibus.language_list) do
l["widget_text"] = wibox.widget { l["widget_text"] = wibox.widget {
{ {
markup = "" .. l["title"] .. "", text = "" .. l["title"] .. "",
align = "left", align = "left",
valign = "center", valign = "center",
font = config.core.font.normal_large, font = config.core.font.normal_large,

View File

@ -53,8 +53,8 @@ widget.widget:connect_signal("mouse::leave", function(result)
end) end)
widget.update = function() widget.update = function()
widget.ibus_indicator_text.markup = config.ibus.language_list[util.current_engine_index]["indicator_code"] widget.ibus_indicator_text.text = config.ibus.language_list[util.current_engine_index]["indicator_code"]
widget.xkb_indicator_text.markup = util.current_xkbmap widget.xkb_indicator_text.text = util.current_xkbmap
end end

View File

@ -132,6 +132,20 @@ mpc_widget.left:connect_signal("button::press",
end end
) )
--[[
function pango.escape(text)
local replacements = {
["&"] = "&",
["<"] = "&lt;",
[">"] = "&gt;",
["\""] = "&quot;",
["'"] = "&apos;",
}
return string.gsub(text, "[&<>'\"]", replacements)
end
]]--
mpc_widget.readupdate = function() mpc_widget.readupdate = function()
-- Update title and artist -- Update title and artist
mpc.mpc_command("current --format \"title=%title% artist=%artist%\"", mpc.mpc_command("current --format \"title=%title% artist=%artist%\"",
@ -140,8 +154,11 @@ mpc_widget.readupdate = function()
return return
end end
mpc_widget.title.markup = string.match(stdout, "title=(.*)artist=") --debug_message(stdout);
mpc_widget.artist.markup = string.match(stdout, "artist=(.*)") --debug_message(string.match(stdout, "title=(.*)artist="));
mpc_widget.title.text = string.match(stdout, "title=(.*)artist=")
mpc_widget.artist.text = string.match(stdout, "artist=(.*)")
end end
) )
@ -160,11 +177,12 @@ mpc_widget.readupdate = function()
mpc_widget.icon_play.image = beautiful.icons.music.blue.stopped mpc_widget.icon_play.image = beautiful.icons.music.blue.stopped
end end
local volume = string.match(stdout, "volume: (%d?%d?%d)%%") local volume = string.match(stdout, "volume: ?(%d?%d?%d)%%")
if (volume) then if (volume) then
mpc_widget.volume.markup = volume .. "%" mpc_widget.volume.text = volume .. "%"
else else
mpc_widget.volume.markup = "" mpc_widget.volume.text = ""
end end
end end
) )