| 1 |
# vim:set ft=sh sw=2 sts=2 et: |
| 2 |
|
| 3 |
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -n "$XDG_RUNTIME_DIR" ] && \ |
| 4 |
[ "$XDG_RUNTIME_DIR" = "/run/user/`id -u`" ] && \ |
| 5 |
[ -S "$XDG_RUNTIME_DIR/bus" ]; then |
| 6 |
# We are under systemd-logind or something remarkably similar, and |
| 7 |
# a user-session socket has already been set up. |
| 8 |
# |
| 9 |
# Be nice to non-libdbus, non-sd-bus implementations by using |
| 10 |
# that as the session bus address in the environment. The check for |
| 11 |
# XDG_RUNTIME_DIR = "/run/user/`id -u`" is because we know that |
| 12 |
# form of the address, from systemd-logind, doesn't need escaping, |
| 13 |
# whereas arbitrary addresses might. |
| 14 |
DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus" |
| 15 |
export DBUS_SESSION_BUS_ADDRESS |
| 16 |
fi |
| 17 |
|
| 18 |
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then |
| 19 |
# tell dbus-daemon --session (and systemd --user, if running) |
| 20 |
# to put a minimal subset of the Xsession's environment in activated |
| 21 |
# services' environments |
| 22 |
dbus-update-activation-environment --verbose --systemd \ |
| 23 |
DBUS_SESSION_BUS_ADDRESS \ |
| 24 |
DISPLAY \ |
| 25 |
XAUTHORITY \ |
| 26 |
XDG_CURRENT_DESKTOP \ |
| 27 |
${NULL+} |
| 28 |
fi |