Reorganize dbus setup order
This commit is contained in:
48
firestarter
48
firestarter
@@ -19,6 +19,7 @@ declare -i _opthelp
|
|||||||
declare -i _optverbose
|
declare -i _optverbose
|
||||||
# Working variables
|
# Working variables
|
||||||
declare -a _args
|
declare -a _args
|
||||||
|
declare -i _hasdbus
|
||||||
declare _return
|
declare _return
|
||||||
|
|
||||||
# Helper functions
|
# Helper functions
|
||||||
@@ -157,29 +158,6 @@ step_preexecute() {
|
|||||||
[ -n "$FIRESTARTER" ] && [ "$FIRESTARTER_DISPLAY" == "$DISPLAY" ] error "Firestarter is already running on $DISPLAY: $FIRESTARTER" 55
|
[ -n "$FIRESTARTER" ] && [ "$FIRESTARTER_DISPLAY" == "$DISPLAY" ] error "Firestarter is already running on $DISPLAY: $FIRESTARTER" 55
|
||||||
export FIRESTARTER="$BASHPID"
|
export FIRESTARTER="$BASHPID"
|
||||||
export FIRESTARTER_DISPLAY="$DISPLAY"
|
export FIRESTARTER_DISPLAY="$DISPLAY"
|
||||||
# dbus
|
|
||||||
if \
|
|
||||||
[ -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
|
|
||||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
|
||||||
hasdbus=1
|
|
||||||
elif \
|
|
||||||
[ -z "$DBUS_SESSION_BUS_ADDRESS" ] && \
|
|
||||||
has dbus-launch; then
|
|
||||||
# We have dbus but haven't started it yet
|
|
||||||
eval "$(dbus-laucnh --exit-with-session --sh-syntax)"
|
|
||||||
hasdbus=1
|
|
||||||
else
|
|
||||||
warn "Did not start dbus; some applications may misbehave"
|
|
||||||
fi
|
|
||||||
if [ -n "$hasdbus" ]; then
|
|
||||||
has dbus-update-activation-environment && \
|
|
||||||
dbus-update-activation-environment --verbose --systemd --all >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
unset hasdbus
|
|
||||||
# IME settings
|
# IME settings
|
||||||
if has uim; then
|
if has uim; then
|
||||||
export GTK_IM_MODULE='uim'
|
export GTK_IM_MODULE='uim'
|
||||||
@@ -212,6 +190,25 @@ step_preexecute() {
|
|||||||
# Disabled here because an XDGCD of KDE implies kded and other KDE parts, breaking copypasta and other things
|
# Disabled here because an XDGCD of KDE implies kded and other KDE parts, breaking copypasta and other things
|
||||||
#export XDG_CURRENT_DESKTOP="KDE"
|
#export XDG_CURRENT_DESKTOP="KDE"
|
||||||
fi
|
fi
|
||||||
|
# dbus
|
||||||
|
# We initialize this after setting envvars so it propogates to the whole session
|
||||||
|
if \
|
||||||
|
[ -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
|
||||||
|
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
||||||
|
_hasdbus=1
|
||||||
|
elif \
|
||||||
|
[ -z "$DBUS_SESSION_BUS_ADDRESS" ] && \
|
||||||
|
has dbus-launch; then
|
||||||
|
# We have dbus but haven't started it yet
|
||||||
|
eval "$(dbus-laucnh --exit-with-session --sh-syntax)"
|
||||||
|
_hasdbus=1
|
||||||
|
else
|
||||||
|
warn "Did not start dbus; some applications may misbehave"
|
||||||
|
fi
|
||||||
# xhost
|
# xhost
|
||||||
if has xhost; then
|
if has xhost; then
|
||||||
if xhost +si:localuser:"$(id -un)" >/dev/null 2>&1; then
|
if xhost +si:localuser:"$(id -un)" >/dev/null 2>&1; then
|
||||||
@@ -278,6 +275,11 @@ step_postexecute() {
|
|||||||
log "Executing rc script: $firestarterrc"
|
log "Executing rc script: $firestarterrc"
|
||||||
"$firestarterrc"
|
"$firestarterrc"
|
||||||
fi
|
fi
|
||||||
|
# Propogate environment variables
|
||||||
|
if [ -n "$_hasdbus" ]; then
|
||||||
|
has dbus-update-activation-environment && \
|
||||||
|
dbus-update-activation-environment --verbose --systemd --all >/dev/null 2>&1
|
||||||
|
fi
|
||||||
# Start XDG autostarters, if they exist
|
# Start XDG autostarters, if they exist
|
||||||
if [ -z "$_optdryrun" ]; then
|
if [ -z "$_optdryrun" ]; then
|
||||||
if has dex; then
|
if has dex; then
|
||||||
|
Reference in New Issue
Block a user