You are not logged in.
Hi there!
I was listening to some long-titled songs (damn you german people) with mpd and my awesome wm's layout got totally wrong.
That was becouse of my mpd widget written with vicious.
I partially solved like this
from:
-- Initialize MPD Widget
mpdwidget = widget({ type = "textbox" })
vicious.register(mpdwidget, vicious.widgets.mpd,
function (widget, args)
if args["{state}"] == "Stop" then
return "Stopped"
elseif args["{state}"] == "Pause" then
return "Paused"
else
return args["{Title}"]..' - '.. args["{Artist}"]
end
end, 0.5)
mpdicon:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn("urxvt -e ncmpcpp", false) end)
))to:
-- Initialize MPD Widget
mpdwidget = widget({ type = "textbox" })
vicious.register(mpdwidget, vicious.widgets.mpd,
function (widget, args)
if args["{state}"] == "Stop" then
return "Stopped"
elseif args["{state}"] == "Pause" then
return "Paused"
else
song = args["{Title}"]..' - '.. args["{Artist}"]
if string.len(song) > 40 then
return string.sub(song, 1, 40)
else
return song
end
end
end, 0.5)
mpdicon:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.util.spawn("urxvt -e ncmpcpp", false) end)
))But I would like to see the entire title, maybe developing something that changes the numbers in the string.sub function as time passes, but if I put, let's say, a for cycle in that code it would return only the last value, or it would turn into an infinite loop if I don't stop it when it reaches the end of the string.
Help me please!
Last edited by ewaves (2012-11-09 14:01:25)
Offline