You are not logged in.
After the recent change in how D-Bus works, applications that are launched by it are not provided with environment variables. E.g.
notify-send "test"
causes the
org.freedesktop.Notifications[621]: cannot open display
(Note, that the display has an empty label.) From the D-Bus/User wiki it's a bit unclear what's the correct way to solve this problem. In '/etc/X11/xinit/xinitrc.d' directory I have '50-systemd-user.sh' file which has the following:
systemctl --user import-environment DISPLAY XAUTHORITY
if which dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi
If this file is launched manually, 'notify-send' begins to work OK.
In the D-Bus/User wiki it's written that one of the ways of exporting env. variables to dbus applications is:
At any time, use systemctl --user set-environment or systemctl --user import-environment. Affects all user units started after setting the environment variables, but not the units that were already running.
Can the problem be an indication that the service unit (/usr/share/dbus-1/services/org.xfce.xfce4-notifyd.Notifications.service in my case) is started before the '50-systemd-user.sh'? If so, is there a correct way to ensure the right order of initialization apart from adding a script which exports environment variables for the second time?
Last edited by nbd (2015-10-05 09:15:04)
bing different
Offline
How are you starting X? If you're using a DM, which one? If you're using startx/xinit, post your ~/.xinitrc.
Offline
I'm using XFCE and start DE manually from login shell by 'startxfce4' (I don't use 'startx').
bing different
Offline
Well, startxfce4 doesn't do anything with files in /etc/X11/xinit/xinitrc.d. Display managers execute these for you and if you use ~/.xinitrc the wiki advises you to not remove the part of the default xinitrc script that sources these scripts. Then 50-systemd-user.sh runs before you start any other applications and dbus activated apps will know $DISPLAY.
startxfce4 runs /etc/xdg/xfce4/xinitrc, which also doesn't refer to this xinitrc.d directory*. You can copy it to ~/.config/xfce4/xinitrc and modify that file to include the for loop you can find in the default xinitrc (and the xinitrc wiki page). Or you can use startx and `exec startxfce4` at the end of ~/.xinitrc (sourcing the xinitrc.d scripts before that, of course). startxfce4 will see that $DISPLAY is set and not start a second X, but it will still run /etc/xdg/xfce4/xinitrc to load Xresources and things like that so you don't have to do that in ~/.xinitrc.
* Note that /etc/xdg/xfce4/xinitrc startx xfce4-session if you have it and this is not a short script, so I haven't look at what it does, but from your description it seems that it doesn't handle this rather new dbus+systemd/user setup.
Last edited by Raynman (2015-10-05 08:52:02)
Offline
I will try to create ~/.config/xfce4/xinitrc (it currently doesn't exist) and copy to it the init staff from the ~/.xinitrc. But first will try to start xfce4 via 'startx' (until the xfce4 adapts its configuration to the new scheme). Thanks for the helping.
bing different
Offline