May 14, 2010 by Tomás Solar Castro
comments (0)
- Visitas: 2999
vicious, awesome, tip, mpd, widget
mpdwidget = widget({ type = 'textbox' })
vicious.register(mpdwidget, vicious.widgets.mpd,
function (widget, args)
local status = ""
if args["{state}"] == "Stop" then status = "Stopped"
elseif args["{state}"] == "Play" then status = "Playing"
elseif args["{state}"] == "Pause" then status = "Paused"
end
return '<span color="white">MPD:</span> '.. status
end)mpdwidget:add_signal('mouse::enter', function ()
local statf = io.popen('mpc -f "\n[[Artist: %artist% \nAlbum: %album% \nTrack: %track%]\nTitle: %title%]|[%file%]" ')
local stat = statf:read("*all")
statf :close()
naughty.notify({ title = "Now Playing"
, text = stat
, timeout = 5
, position = "top_right"
})
end)mpdwidget:buttons({
button({ }, 1, function () awful.util.spawn("mpc toggle") end),
button({ }, 2, function () awful.util.spawn("mpc stop") end),
button({ }, 3, function () awful.util.spawn(terminal .. " -e ncmpcpp") end),
button({ }, 4, function () awful.util.spawn("mpc prev") end),
button({ }, 5, function () awful.util.spawn("mpc next") end)
})
Espero que les sirva :)
Saludos!
Happy Hacking!
