eonpatapon / mpDris2

MPRIS V2.1 support for mpd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Systemd user service doesn't work

pavelkogan opened this issue · comments

I'm trying to set up a systemd user service to work with gnome-shell-extensions-mediaplayer.

I can get mpDris2 to run through systemd, but the extension doesn't pick anything up. It does work when I just run mpDris2 from the command line.

Looking at the service status, the only difference I can see from just running the command is the following extra log:

2016-05-05 13:44:13,100 mpDris2 WARNING: Failed to connect to GNOME Settings Daemon. Media keys won't work.

When I try to monitor the bus:

gdbus monitor --session --dest org.mpris.MediaPlayer2.mpd

Instead of working with the running systemd mpDris2, it starts a new one (which works with the extension). Not sure what this means.

This will only work correctly if your distro has enabled the "user bus" for everything.

systemd --user services don't have access to the "session" bus (of which there can be several anyway), since they run outside a session. They instead have a "user" bus shared across all sessions, and graphical sessions can be configured to connect to the user bus instead of launching a session bus.

(The user bus works the same way as a session bus would, including tools using it via the --session option etc. – the only technical difference is that it's started by dbus.service instead of dbus-launch, and has a fixed address instead of a random one.)

I'm on Ubuntu 16.04. I did install dbus-user-session and start a user bus with systemctl --user enable dbus.service, etc., since the mpDris2 service wouldn't start without it.

Do I need to do something else to get this to work? You said something about configuring graphical sessions?

The combination of mpDris2 and dbus-user-session definitely works on Debian (I maintain those Debian packages).

Ubuntu might have some weirdness around the way their sessions are currently launched via Upstart - you might need to wait for a later Ubuntu release for this to work properly. I know there's work currently being done, for Ubuntu 16.10 or later, to enable dbus-user-session by default and migrate from Upstart to systemd to launch graphical sessions.