Refactor dbus launch code

This should fix not launching dbus when we certainly can
This commit is contained in:
Salt 2020-07-25 19:47:48 -05:00
parent 643fba814a
commit da05005665

View File

@ -159,17 +159,11 @@ step_preexecute() {
export FIRESTARTER="$BASHPID" export FIRESTARTER="$BASHPID"
export FIRESTARTER_DISPLAY="$DISPLAY" export FIRESTARTER_DISPLAY="$DISPLAY"
# dbus # dbus
if \ if [ -n "$DBUS_SESSION_BUS_ADDRESS" ]; then
[ -z "$DBUS_SESSION_BUS_ADDRESS" ] && \
[ -n "$XDG_RUNTIME_DIR" ] && \
[ "$XDG_RUNTIME_DIR" = "/run/user/$(id -u)" ] && \
[ -S "$XDG_RUNTIME_DIR/bus" ]; then
# We already have a bus started; use it # We already have a bus started; use it
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus" export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
_hasdbus=1 _hasdbus=1
elif \ elif [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && has dbus-launch; then
[ -z "$DBUS_SESSION_BUS_ADDRESS" ] && \
has dbus-launch; then
# We have dbus but haven't started it yet # We have dbus but haven't started it yet
eval "$(dbus-launch --exit-with-session --sh-syntax)" eval "$(dbus-launch --exit-with-session --sh-syntax)"
_hasdbus=1 _hasdbus=1
@ -179,7 +173,7 @@ step_preexecute() {
# Nest protection # Nest protection
if [ -n "$_hasdbus" ]; then if [ -n "$_hasdbus" ]; then
log "Exporting to dbus: FIRESTARTER FIRESTARTER_DISPLAY" log "Exporting to dbus: FIRESTARTER FIRESTARTER_DISPLAY"
dbus-update-activation-environment FIRESTARTER FIRESTARTER_DISPLAY dbus-update-activation-environment --systemd FIRESTARTER FIRESTARTER_DISPLAY
fi fi
# IME settings # IME settings
if has uim; then if has uim; then
@ -193,7 +187,7 @@ step_preexecute() {
fi fi
if [ -n "$_hasdbus" ]; then if [ -n "$_hasdbus" ]; then
log "Exporting to dbus: GTK_IM_MODULE QT_IM_MODULE XMODIFIERS" log "Exporting to dbus: GTK_IM_MODULE QT_IM_MODULE XMODIFIERS"
dbus-update-activation-environment GTK_IM_MODULE QT_IM_MODULE XMODIFIERS dbus-update-activation-environment --systemd GTK_IM_MODULE QT_IM_MODULE XMODIFIERS
fi fi
# kcminit/Qt settings # kcminit/Qt settings
if has qt5ct; then if has qt5ct; then
@ -212,7 +206,7 @@ step_preexecute() {
fi fi
if [ -n "$_hasdbus" ]; then if [ -n "$_hasdbus" ]; then
log "Exporting to dbus: QT_QPA_PLATFORMTHEME QT_AUTO_SCREEN_SCALE_FACTOR" log "Exporting to dbus: QT_QPA_PLATFORMTHEME QT_AUTO_SCREEN_SCALE_FACTOR"
dbus-update-activation-environment QT_QPA_PLATFORMTHEME QT_AUTO_SCREEN_SCALE_FACTOR dbus-update-activation-environment --systemd QT_QPA_PLATFORMTHEME QT_AUTO_SCREEN_SCALE_FACTOR
fi fi
fi fi
if has kcminit; then if has kcminit; then