I can't get the mpd widget working properly (and/or guidance needed).
rigoletto-freebsd opened this issue · 22 comments
awesome devel (Too long)
• Compiled against Lua 5.2.4 (running with Lua 5.2)
• D-Bus support: ✔
• execinfo support: ✔
• xcb-randr version: 1.6
• LGI version: 0.9.2
Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
FreeBSD 13.0-RELEASE
OBS. also tested against Lua 5.3, same behavior.
Disclamer: I'm new to AwesomeWM and am know little to nothing about Lua.
1- adding local local mympd = lain.widget.mpd()
alone works in a sense the notification appear but not the cover art, and this is important to not the music is archived in ~/Music
and mpd
actually listen to 10.0.0.10 but when setting: local mympd = lain.widget.mpd({host = "10.0.0.10"})
the result is the same except the notification never disappear.
2- adding this mpd widget example (and also to Wibar config) does nothing, nothing showup.
PS. no Xorg errors.
Thank you.
Replace this line with mympd.widget
, and read the wiki to know how to make customizations.
For instance, to set your music folder:
-- in your statusbar.lua
local lain = require("lain")
local markup = lain.util.markup
local mympd = lain.widget.mpd {
music_dir = "/path/to/your/music/directory", -- change here
settings = function()
mpd_notification_preset.fg = "#FFFFFF"
artist = mpd_now.artist .. " "
title = mpd_now.title .. " "
if mpd_now.state == "pause" then
artist = "mpd "
title = "paused "
elseif mpd_now.state == "stop" then
artist = ""
title = ""
end
widget:set_markup(markup.font(theme.font, markup("#9E9C9A", artist) .. title .. " "))
end
}
Hello,
I changed mympd
to mympd.widget
but no difference, the widget doesn't show up. The music directory is the default so no need to change but I did it anyway to test (reinforce), and also used the example to set host
correctly and again, the notification is persistent and without the album cover.
Btw, just to confirm all albums have a cover.jpg file in it.
Thank you.
Naive questions: do you see "N/A N/A" in the top left-hand corner? When you launch MPD, does the widget update, or does the notification appear?
Try using this as your ~/.config/awesome.rc.lua
. Do you see "mpd off" in the top right-hand corner?
The widget doesn't show at all. I see nothing except the notification which appear but without the album cover, and if I set host
(mpd is actually on 10.0.0.10) the notification appear and doesn't disappear anymore.[1]
The proposed file give a error, bad argument at line 585 and 586. I don't know how to fix it.
[1] if I click on it, it disappear for a moment and appear again.
Thank you.
Try removing lines 585 and 586. If you still have errors, just apply the same modification to the default rc.lua
under FreeBSD. That is, just add the lines 21, 107-129, 236. What does the notification say? Is it empty? Are you sure your MPD is configured correctly?
The notification display the expected information except by the album cover. This MPD configuration is in place since 2016 with minor changes of the times, I suppose everything is correct.
I will be able to try the provided configuration again soon.
Thank you.
For the record, for comparative purposes, the Polybar
mpd module works as expected.
I tried commenting the lines with error (585 and 586) and the widget appeared but as mpd off
but the information was not updated, ever when changing tracks. Also, the notification worked but again without the cover art.
Thanks.
the notification worked but again without the cover art
Do you mean that it displayed the text Now playing...?
With MPD on, can you run this command and get the information without issues?
printf "status\ncurrentsong\nclose\n" | curl --connect-timeout 1 -fsm 3 telnet://127.0.0.1:6600
If this exact command does not work, play around with curl
and see how you can make it work.
For the record, for comparative purposes, the
polybar
mpd module works as expected.
FYI, polybar
uses the ad hoc C library libmpdclient
, while we use curl
, which is widely adopted.
I have not tested it but it seems the vicious mpd
widget works. Their widgets with incompatibilities have a separated FreeBSD version.
Did you try setting your host? Continuing with the above example:
-- in your statusbar.lua
local lain = require("lain")
local markup = lain.util.markup
local mympd = lain.widget.mpd {
host = "10.0.0.10", -- <--
settings = function()
mpd_notification_preset.fg = "#FFFFFF"
artist = mpd_now.artist .. " "
title = mpd_now.title .. " "
if mpd_now.state == "pause" then
artist = "mpd "
title = "paused "
elseif mpd_now.state == "stop" then
artist = ""
title = ""
end
widget:set_markup(markup.font(theme.font, markup("#9E9C9A", artist) .. title .. " "))
end
}
Yes, but when I set it the only change is the notification that doesn't disappear anymore. If I click on it disappear but after a moment it appear again - pretty weird.
Thank you!
The only thing that comes to my mind is to start with a default rc.lua
and a minimal lain
configuration, like this one, and try it to debug it yourself by checking X's stdout for errors.
One thing that came to mind now is mpd
is called musicpd
on FreeBSD (due to conflict with something in FreeBSD Base).
This is not important, as we connect to the service's address:port. When you can, check X logs as I mentioned above.
I used the provided minimal configuration (I think I committed a mistake on the command line the first time I tried it).
No music playing: "MPD off"
With Music playing: the expected information is displayed (artist and title)
Notification: all expected text information is in there, but again no cover art
[EDIT]
With host
set correctly (10.0.0.10) the notification appear and disappear correctly too.
Thank you.
Don't ask me how but I managed to have some progress. :-D
Now the widget appear and work nicely provided host
is set correctly (otherwise mpd off
); however the notification refuse to disappear unless host
is set to default. In any circumstance no cover art in the notification.
[EDIT]
I changed the mpd
configuration to listen on 127.0.0.1
(to have it working) and the widget and notification are working, except by the lack of album cover in the notification, and what seems to be an extra Now Playing
bubble.
I will update the files on gitlab later.
Thank you.
In your xorg.log
, you have a lot of these errors:
E: awesome: Failed to load 'inactive': Failed to open file “inactive”: No such file or directory
E: awesome: Failed to load '': Failed to open file “”: No such file or directory
Last step: cd
to a music folder with a cover image file, and run this command:
find . -maxdepth 1 -type f | egrep -i m1 '*\.(jpg|jpeg|png|gif)$'
Modify it until it returns the image file (e.g., cover.jpg
). Then, use the last argument of the above command as the cover_pattern
argument of the widget (escaping it in Lua format). Example:
local lain = require("lain")
local markup = lain.util.markup
local mympd = lain.widget.mpd {
cover_pattern = "*\\.(jpg|jpeg|png|gif)$", -- modify accordingly, remember to escaping it
settings = function()
mpd_notification_preset.fg = "#FFFFFF"
artist = mpd_now.artist .. " "
title = mpd_now.title .. " "
if mpd_now.state == "pause" then
artist = "mpd "
title = "paused "
elseif mpd_now.state == "stop" then
artist = ""
title = ""
end
widget:set_markup(markup.font(theme.font, markup("#9E9C9A", artist) .. title .. " "))
end
}
Wow, that did the trick: "\.(jpg|jpeg|png|gif)$"
. Albeit there two issues:
1 - host
need to be set explicit (127.0.0.1) otherwise the cover art doesn't show up.
2 - it needs to be 127.0.0.1
(not tested localhost
) otherwise the notification doesn't disappear. ^^
Thank you.
We solved it, then? If so, please close the issue. Otherwise, please let me how can I help you further.
Yes, I think this is solved. There is still the issue of the notification that doesn't disappear when the host
is set different of 127.0.0.1
but this is likely to be related with something else.
@lcpz really thank you for your support.