1
description "Run systemd user units for graphical session"
2
author "Martin Pitt <martin.pitt@ubuntu.com>"
4
# this is normally done by the /usr/share/xsessions/*.desktop's Exec= line, but
5
# as Xsession.d/99upstart completely nullifies $STARTUP, we need to replicate it
6
# through this upstart job.
11
# some services talk to upstart in code, and for the transition period we
12
# also want this to be in shells
13
if [ -x "/usr/bin/dbus-update-activation-environment" ]; then
14
dbus-update-activation-environment --verbose --systemd UPSTART_SESSION
17
# robustness: if the previous graphical session left some failed units,
18
# reset them so that they don't break this startup
19
for unit in $(systemctl --user --no-legend --state=failed list-units | cut -f1 -d' '); do
20
if [ "$(systemctl --user show -p PartOf --value)" = "graphical-session.target" ]; then
21
systemctl --user reset-failed $unit
25
systemctl --user restart graphical-session-pre.target
26
systemctl --user restart ${DESKTOP_SESSION}-session.target
29
# delay killing the X server until all graphical units stopped
30
# FIXME: we currently cannot make targets wait on its dependencies going to
31
# "inactive", only to "deactivating"
33
while [ -n "$(systemctl --user --no-legend --state=deactivating list-units)" ]; do sleep 0.2; done
35
# dirt-cheap workaround for https://bugzilla.gnome.org/show_bug.cgi?id=768943
36
pkill -ef gnome-keyring-daemon