DBus Error - xinitrc

I tried to use Spotify dbus interface to play/pause tracks, found a nice shell script but it did not work, but instead I got this error message:

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.mpris.MediaPlayer2.spotify was not provided by any .service files

Turned out that the issue is probably with my X11 session initialization.

Note: At the very least, ensure that the last if block in /etc/X11/xinit/xinitrc is present in your ~/.xinitrc file to ensure that the scripts in /etc/X11/xinit/xinitrc.d are sourced.

So, I tried to source the /etc/X11/Xsession before I start the window manager:

. /etc/X11/Xsession
exec i3

(i3 is my window manager)

Called startx but no luck, X did not start. The following error was in the ~/.xsession-errors:

dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.InvalidArgs: Invalid environment assignments

I had no clue what would that mean, however after some echo based debugging in /etc/X11/Xsession I could confirm that the files from /etc/X11/Xsession.d were sourced and the last file which was sourced is /etc/X11/Xsession.d/99x11-common_start. That file is a one liner:

exec $STARTUP

I guessed that $STARTUP is undefined. Checked where it would be defined and I found /etc/X11/Xsession.d/50x11-common_determine-startup

If no X session startup program was passed to the Xsession script as an argument (e.g., by the display manager), or if that program was not executable, fall back to looking for a user's custom X session script, if allowed by the options file.

That means I can define it somehow, so I tried by setting it in my:

export STARTUP=i3
. /etc/X11/Xsession

Then everything looks good. Some magic happens in those files (probably in /etc/X11/Xsession.d/20dbus_xdg-runtime) what I didn't tried to figure out yet.

Hozzászóláshoz a Disqus szolgáltatását használom, korábbi vélemények elovlasásához és új hozzászólás írásához engedélyezd a Disqus-tól származó JavaScripteteket.