Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control remote MPD using Lain widget #309

Closed
zenodotus280 opened this issue Dec 2, 2023 · 2 comments
Closed

control remote MPD using Lain widget #309

zenodotus280 opened this issue Dec 2, 2023 · 2 comments

Comments

@zenodotus280
Copy link

I am trying to control a remote MPD instance using the PowerArrow Dark theme. I modified the mpd.lua with the correct MPD_HOST value. I can connect without issue using mpc -h example.com -p 6600 but I can't convince Awesome to pull the artist and title info into the status bar. I have created an mpd.conf and tried to direct the localhost instance to my example.com instance but it hasn't had any effect.

Any help would be greatly appreciated. I have not found anyone attempting to do this and no closed issues address this.

Awesome v4.3 (Too long)
• Compiled against Lua 5.3.6 (running with Lua 5.3)
• D-Bus support: ✔
• execinfo support: ✔
• xcb-randr version: 1.6
• LGI version: 0.9.2

Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio

@lcpz lcpz added the lain label Dec 4, 2023
@lcpz
Copy link
Owner

lcpz commented Dec 4, 2023

You're not supposed to modify mpd.lua, but rather write a Lain MPD widget in theme.lua. Example:

theme.mpd = lain.widget.mpd {
    host = "example.com",
    port = "6600",
    music_dir = "path/to/your/music/directory",
    settings = function()
        widget:set_markup(mpd_now.artist .. " " .. mpd_now.title)
    end
}

Reference: Lain MPD widget documentation.

@zenodotus280
Copy link
Author

Thank you! I thought I had tried that already but I didn't put the host, port, and music directory high enough in the widget. The music dir wasn't needed in the end as MPD must handle that remotely and the default is also port 6600 so I could have omitted that too.

For anyone else wanting confirmation on what's needed (the first part is so I can 'super+left-click' to open a TUI music controller):

-- MPD
local mpc_remote = " -h moode.home.arpa -p 6600"
local musicplr = awful.util.terminal .. " -e ncmpcpp" .. mpc_remote
local mpdicon = wibox.widget.imagebox(theme.widget_music)

[...]

theme.mpd = lain.widget.mpd({
    host = "moode.home.arpa",
    port = "6600",
    settings = function()
    
[...]

@lcpz lcpz self-assigned this Dec 5, 2023
@lcpz lcpz closed this as completed Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants