szclsya / mpdris2-rs

Exposing MPRIS V2.2 D-Bus interface for mpd
GNU General Public License v3.0
31 stars 1 forks source link

mpdris2-rs-0.1.3 can't start #5

Closed acid-bong closed 1 year ago

acid-bong commented 1 year ago

Running the app instantly gives an error:

 ERROR I/O error: No such file or directory (os error 2)
DUE TO No such file or directory (os error 2)

Here's the output with verbosity level 1 and 2 (ignore the ANSI color codes around the first words)

Rust version: 1.67.1

szclsya commented 1 year ago

Looks like a D-Bus connection issue since the mpd connection seems okay. Do your system have /run/user/$UID/bus socket?

acid-bong commented 1 year ago

No, my dbus socket is /tmp/dbus-<alphanum>, and I'm not starting my window manager (dwm) with dbus-launch or dbus-run-session, so that the $DBUS_SESSION_BUS_ADDRESS isn't in the environment.

szclsya commented 1 year ago

Then that should be the root of the issue. The library this program's using (zbus) reads $DBUS_SESSION_BUS_ADDRESS and fall backs to $XDG_RUNTIME_DIR/bus if that doesn't exists. (See https://docs.rs/zbus/latest/zbus/enum.Address.html#method.session)

I guess I can add a feature to manually specify the bus address. What do you think?

acid-bong commented 1 year ago

Better not, since $DBUS_SESSION_BUS_ADDRESS isn't always XDG_RUNTIME_DIR/bus and (at least by running dbus-launch) it creates a socket in /tmp. I think you should clarify in README that such a variable needs to be exposed.

Also I started my sx (using it instead of xinit) with dbus-launch --exit-with-session, and the mpdris caught on well

szclsya commented 1 year ago

True. I've added some doc about it (b97dc57) and improved the error reporting when session bus doesn't exist (b8f1f6c).