              break
          fi
 @@ -339,15 +369,17 @@ fi
-
+ 
  echo 'startkde: Shutting down...'  1>&2
  # just in case
 -test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
 +if [ -n "$ksplash_pid" ]; then
 +    kill "$ksplash_pid" 2>/dev/null
 +fi
-
+ 
  # Clean up
 -kdeinit5_shutdown
 +@NIXPKGS_KDEINIT5_SHUTDOWN@
-
+ 
  unset KDE_FULL_SESSION
 -xprop -root -remove KDE_FULL_SESSION
 +@NIXPKGS_XPROP@ -root -remove KDE_FULL_SESSION

@@ -135,71 +224,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

+if [ -r "$XDG_CONFIG_HOME/startupconfig" ]; then
+    . "$XDG_CONFIG_HOME/startupconfig"
 fi
 
-[ -r $configDir/startupconfig ] && . $configDir/startupconfig
-
-xrdb -quiet -merge -nocpp <<EOF
+if [ "$kcmfonts_general_forcefontdpi" -ne 0 ]; then
+    @NIXPKGS_XRDB@ -quiet -merge -nocpp <<EOF
 Xft.dpi: $QT_WAYLAND_FORCE_DPI
 EOF
+fi
 
 dl=$DESKTOP_LOCKED
 unset DESKTOP_LOCKED # Don't want it in the environment
 
 ksplash_pid=
-if test -z "$dl"; then
+if [ -z "$dl" ]; then
