kde5.startkde: initialize session variables before loading user env

The desktop session variables need to be initialized before loading the
user environment scripts so that these scripts can exec programs that
rely on the session variables. For example, these variables must be set
when gpg-agent is started or pinentry-qt will not respect the user's
theme settings.
This commit is contained in:
Thomas Tuegel 2016-08-26 08:40:30 -05:00
parent a0aa333aa9
commit 3616b52e20
No known key found for this signature in database
GPG key ID: 22CBF5249D4B4D59

View file

@ -185,28 +185,6 @@ if test -z "$dl"; then
esac
fi
# Source scripts found in <config locations>/plasma-workspace/env/*.sh
# (where <config locations> correspond to the system and user's configuration
# directories, as identified by Qt's qtpaths, e.g. $HOME/.config
# and /etc/xdg/ on Linux)
#
# This is where you can define environment variables that will be available to
# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
# or eval `gpg-agent --daemon`.
# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
#
# (see end of this file).
# For anything else (that doesn't set env vars, or that needs a window manager),
# better use the Autostart folder.
IFS=":" read -r -a scriptpath <<< $(qtpaths --paths GenericConfigLocation)
# Add /env/ to the directory to locate the scripts to be sourced
for prefix in "${scriptpath[@]}"; do
for file in "$prefix"/plasma-workspace/env/*.sh; do
test -r "$file" && . "$file" || true
done
done
echo 'startkde: Starting up...' 1>&2
# Make sure that D-Bus is running
@ -255,6 +233,28 @@ export KDE_SESSION_UID
XDG_CURRENT_DESKTOP=KDE
export XDG_CURRENT_DESKTOP
# Source scripts found in <config locations>/plasma-workspace/env/*.sh
# (where <config locations> correspond to the system and user's configuration
# directories, as identified by Qt's qtpaths, e.g. $HOME/.config
# and /etc/xdg/ on Linux)
#
# This is where you can define environment variables that will be available to
# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
# or eval `gpg-agent --daemon`.
# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
#
# (see end of this file).
# For anything else (that doesn't set env vars, or that needs a window manager),
# better use the Autostart folder.
IFS=":" read -r -a scriptpath <<< $(qtpaths --paths GenericConfigLocation)
# Add /env/ to the directory to locate the scripts to be sourced
for prefix in "${scriptpath[@]}"; do
for file in "$prefix"/plasma-workspace/env/*.sh; do
test -r "$file" && . "$file" || true
done
done
# At this point all the environment is ready, let's send it to kwalletd if running
if test -n "$PAM_KWALLET_LOGIN" ; then
env | socat STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN