···11+Index: plasma-workspace-5.5.5/startkde/startkde.cmake
22+===================================================================
33+--- plasma-workspace-5.5.5.orig/startkde/startkde.cmake
44++++ plasma-workspace-5.5.5/startkde/startkde.cmake
55+@@ -1,8 +1,36 @@
66+-#!/bin/sh
77++#!@bash@
88+ #
99+ # DEFAULT KDE STARTUP SCRIPT ( @PROJECT_VERSION@ )
1010+ #
1111+1212++set -x
1313++
1414++# The KDE icon cache is supposed to update itself
1515++# automatically, but it uses the timestamp on the icon
1616++# theme directory as a trigger. Since in Nix the
1717++# timestamp is always the same, this doesn't work. So as
1818++# a workaround, nuke the icon cache on login. This isn't
1919++# perfect, since it may require logging out after
2020++# installing new applications to update the cache.
2121++# See http://lists-archives.org/kde-devel/26175-what-when-will-icon-cache-refresh.html
2222++rm -fv $HOME/.cache/icon-cache.kcache
2323++
2424++# Qt writes a weird ‘libraryPath’ line to
2525++# ~/.config/Trolltech.conf that causes the KDE plugin
2626++# paths of previous KDE invocations to be searched.
2727++# Obviously using mismatching KDE libraries is potentially
2828++# disastrous, so here we nuke references to the Nix store
2929++# in Trolltech.conf. A better solution would be to stop
3030++# Qt from doing this wackiness in the first place.
3131++if [ -e $HOME/.config/Trolltech.conf ]; then
3232++ @sed@ -e '/nix\\store\|nix\/store/ d' -i $HOME/.config/Trolltech.conf
3333++fi
3434++
3535++# (NixOS) We run kbuildsycoca5 before starting the user session because things
3636++# may be missing or moved if they have run nixos-rebuild and it may not be
3737++# possible for them to start Konsole to run it manually!
3838++@kbuildsycoca5@
3939++
4040+ if test "x$1" = x--failsafe; then
4141+ KDE_FAILSAFE=1 # General failsafe flag
4242+ KWIN_COMPOSE=N # Disable KWin's compositing
4343+@@ -17,29 +45,16 @@ trap 'echo GOT SIGHUP' HUP
4444+ # we have to unset this for Darwin since it will screw up KDE's dynamic-loading
4545+ unset DYLD_FORCE_FLAT_NAMESPACE
4646+4747+-# in case we have been started with full pathname spec without being in PATH
4848+-bindir=`echo "$0" | sed -n 's,^\(/.*\)/[^/][^/]*$,\1,p'`
4949+-if [ -n "$bindir" ]; then
5050+- qbindir=`qtpaths --binaries-dir`
5151+- qdbus=$qbindir/qdbus
5252+- case $PATH in
5353+- $bindir|$bindir:*|*:$bindir|*:$bindir:*) ;;
5454+- *) PATH=$bindir:$PATH; export PATH;;
5555+- esac
5656+-else
5757+- qdbus=qdbus
5858+-fi
5959+-
6060+ # Check if a KDE session already is running and whether it's possible to connect to X
6161+-kcheckrunning
6262++@kcheckrunning@
6363+ kcheckrunning_result=$?
6464+ if test $kcheckrunning_result -eq 0 ; then
6565+- echo "KDE seems to be already running on this display."
6666+- xmessage -geometry 500x100 "KDE seems to be already running on this display." > /dev/null 2>/dev/null
6767++ echo "KDE seems to be already running on this display."
6868++ @xmessage@ -geometry 500x100 "KDE seems to be already running on this display."
6969+ exit 1
7070+ elif test $kcheckrunning_result -eq 2 ; then
7171+ echo "\$DISPLAY is not set or cannot connect to the X server."
7272+- exit 1
7373++ exit 1
7474+ fi
7575+7676+ # Boot sequence:
7777+@@ -57,13 +72,8 @@ fi
7878+ # * Then ksmserver is started which takes control of the rest of the startup sequence
7979+8080+ # We need to create config folder so we can write startupconfigkeys
8181+-if [ ${XDG_CONFIG_HOME} ]; then
8282+- configDir=$XDG_CONFIG_HOME;
8383+-else
8484+- configDir=${HOME}/.config; #this is the default, http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
8585+-fi
8686+-
8787+-mkdir -p $configDir
8888++configDir=$(@qtpaths@ --writable-path GenericConfigLocation)
8989++mkdir -p "$configDir"
9090+9191+ #This is basically setting defaults so we can use them with kstartupconfig5
9292+ cat >$configDir/startupconfigkeys <<EOF
9393+@@ -102,42 +112,10 @@ XftSubPixel=none
9494+ EOF
9595+ }
9696+9797+-# Make sure the Oxygen font is installed
9898+-# This is necessary for setups where CMAKE_INSTALL_PREFIX
9999+-# is not in /usr. fontconfig looks in /usr, ~/.fonts and
100100+-# $XDG_DATA_HOME for fonts. In this case, we symlink the
101101+-# Oxygen font under ${XDG_DATA_HOME} and make it known to
102102+-# fontconfig
103103+-
104104+-usr_share="/usr/share"
105105+-install_share="@KDE_INSTALL_FULL_DATADIR@"
106106+-
107107+-if [ ! $install_share = $usr_share ]; then
108108+-
109109+- if [ ${XDG_DATA_HOME} ]; then
110110+- fontsDir="${XDG_DATA_HOME}/fonts"
111111+- else
112112+- fontsDir="${HOME}/.fonts"
113113+- fi
114114+-
115115+- test -d $fontsDir || {
116116+- mkdir -p $fontsDir
117117+- }
118118+-
119119+- oxygenDir=$fontsDir/oxygen
120120+- prefixDir="@KDE_INSTALL_FULL_DATADIR@/fonts/oxygen"
121121+-
122122+- # if the oxygen dir doesn't exist, create a symlink to be sure that the
123123+- # Oxygen font is available to the user
124124+- test -d $oxygenDir || test -d $prefixDir && {
125125+- test -h $oxygenDir || ln -s $prefixDir $oxygenDir && fc-cache $oxygenDir
126126+- }
127127+-fi
128128+-
129129+-kstartupconfig5
130130++@out@/bin/kstartupconfig5
131131+ returncode=$?
132132+ if test $returncode -ne 0; then
133133+- xmessage -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
134134++ @xmessage@ -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
135135+ exit 1
136136+ fi
137137+ [ -r $configDir/startupconfig ] && . $configDir/startupconfig
138138+@@ -146,9 +124,11 @@ if test "$kdeglobals_kscreen_scalefactor
139139+ export QT_DEVICE_PIXEL_RATIO=$kdeglobals_kscreen_scalefactor
140140+ fi
141141+142142++XCURSOR_PATH=~/.icons:$(echo "$XDG_DATA_DIRS" | @tr@ ":" "\n" | @sed@ 's,$,/icons,g' | @tr@ "\n" ":")
143143++export XCURSOR_PATH
144144++
145145+ # XCursor mouse theme needs to be applied here to work even for kded or ksmserver
146146+ if test -n "$kcminputrc_mouse_cursortheme" -o -n "$kcminputrc_mouse_cursorsize" ; then
147147+- @EXPORT_XCURSOR_PATH@
148148+149149+ kapplymousetheme "$kcminputrc_mouse_cursortheme" "$kcminputrc_mouse_cursorsize"
150150+ if test $? -eq 10; then
151151+@@ -164,21 +144,39 @@ if test -n "$kcminputrc_mouse_cursorthem
152152+ fi
153153+ fi
154154+155155+-if test "$kcmfonts_general_forcefontdpi" -ne 0; then
156156+- xrdb -quiet -merge -nocpp <<EOF
157157+-Xft.dpi: $kcmfonts_general_forcefontdpi
158158+-EOF
159159+-fi
160160++# Set a left cursor instead of the standard X11 "X" cursor, since I've heard
161161++# from some users that they're confused and don't know what to do. This is
162162++# especially necessary on slow machines, where starting KDE takes one or two
163163++# minutes until anything appears on the screen.
164164++#
165165++# If the user has overwritten fonts, the cursor font may be different now
166166++# so don't move this up.
167167++#
168168++@xsetroot@ -cursor_name left_ptr
169169+170170+ dl=$DESKTOP_LOCKED
171171+ unset DESKTOP_LOCKED # Don't want it in the environment
172172+173173++# Make sure that D-Bus is running
174174++# D-Bus autolaunch is broken
175175++if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
176176++ eval `@dbus-launch@ --sh-syntax --exit-with-session`
177177++fi
178178++if @qdbus@ >/dev/null 2>/dev/null; then
179179++ : # ok
180180++else
181181++ echo 'startkde: Could not start D-Bus. Can you call qdbus?' 1>&2
182182++ test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
183183++ @xmessage@ -geometry 500x100 "Could not start D-Bus. Can you call qdbus?"
184184++ exit 1
185185++fi
186186++
187187+ ksplash_pid=
188188+ if test -z "$dl"; then
189189+ # the splashscreen and progress indicator
190190+ case "$ksplashrc_ksplash_engine" in
191191+ KSplashQML)
192192+- ksplash_pid=`ksplashqml "${ksplashrc_ksplash_theme}" --pid`
193193++ ksplash_pid=`@out@/bin/ksplashqml "${ksplashrc_ksplash_theme}" --pid`
194194+ ;;
195195+ None)
196196+ ;;
197197+@@ -201,8 +199,7 @@ fi
198198+ # For anything else (that doesn't set env vars, or that needs a window manager),
199199+ # better use the Autostart folder.
200200+201201+-# TODO: Use GenericConfigLocation once we depend on Qt 5.4
202202+-scriptpath=`qtpaths --paths ConfigLocation | tr ':' '\n' | sed 's,$,/plasma-workspace,g'`
203203++scriptpath=$(@qtpaths@ --paths GenericConfigLocation | tr ':' '\n' | @sed@ 's,$,/plasma-workspace,g')
204204+205205+ # Add /env/ to the directory to locate the scripts to be sourced
206206+ for prefix in `echo $scriptpath`; do
207207+@@ -232,7 +229,7 @@ usr_odir=$HOME/.fonts/kde-override
208208+ usr_fdir=$HOME/.fonts
209209+210210+ if test -n "$KDEDIRS"; then
211211+- kdedirs_first=`echo "$KDEDIRS"|sed -e 's/:.*//'`
212212++ kdedirs_first=`echo "$KDEDIRS" | @sed@ -e 's/:.*//'`
213213+ sys_odir=$kdedirs_first/share/fonts/override
214214+ sys_fdir=$kdedirs_first/share/fonts
215215+ else
216216+@@ -245,23 +242,13 @@ fi
217217+ # add the user's dirs to the font path, as they might simply have been made
218218+ # read-only by the administrator, for whatever reason.
219219+220220+-test -d "$sys_odir" && xset +fp "$sys_odir"
221221+-test -d "$usr_odir" && (mkfontdir "$usr_odir" ; xset +fp "$usr_odir")
222222+-test -d "$usr_fdir" && (mkfontdir "$usr_fdir" ; xset fp+ "$usr_fdir")
223223+-test -d "$sys_fdir" && xset fp+ "$sys_fdir"
224224++test -d "$sys_odir" && @xset@ +fp "$sys_odir"
225225++test -d "$usr_odir" && ( @mkfontdir@ "$usr_odir" ; @xset@ +fp "$usr_odir" )
226226++test -d "$usr_fdir" && ( @mkfontdir@ "$usr_fdir" ; @xset@ fp+ "$usr_fdir" )
227227++test -d "$sys_fdir" && @xset@ fp+ "$sys_fdir"
228228+229229+ # Ask X11 to rebuild its font list.
230230+-xset fp rehash
231231+-
232232+-# Set a left cursor instead of the standard X11 "X" cursor, since I've heard
233233+-# from some users that they're confused and don't know what to do. This is
234234+-# especially necessary on slow machines, where starting KDE takes one or two
235235+-# minutes until anything appears on the screen.
236236+-#
237237+-# If the user has overwritten fonts, the cursor font may be different now
238238+-# so don't move this up.
239239+-#
240240+-xsetroot -cursor_name left_ptr
241241++@xset@ fp rehash
242242+243243+ # Get Ghostscript to look into user's KDE fonts dir for additional Fontmap
244244+ if test -n "$GS_LIB" ; then
245245+@@ -274,26 +261,6 @@ fi
246246+247247+ echo 'startkde: Starting up...' 1>&2
248248+249249+-# Make sure that the KDE prefix is first in XDG_DATA_DIRS and that it's set at all.
250250+-# The spec allows XDG_DATA_DIRS to be not set, but X session startup scripts tend
251251+-# to set it to a list of paths *not* including the KDE prefix if it's not /usr or
252252+-# /usr/local.
253253+-if test -z "$XDG_DATA_DIRS"; then
254254+- XDG_DATA_DIRS="@CMAKE_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@:/usr/share:/usr/local/share"
255255+-fi
256256+-export XDG_DATA_DIRS
257257+-
258258+-# Make sure that D-Bus is running
259259+-if $qdbus >/dev/null 2>/dev/null; then
260260+- : # ok
261261+-else
262262+- echo 'startkde: Could not start D-Bus. Can you call qdbus?' 1>&2
263263+- test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
264264+- xmessage -geometry 500x100 "Could not start D-Bus. Can you call qdbus?"
265265+- exit 1
266266+-fi
267267+-
268268+-
269269+ # Mark that full KDE session is running (e.g. Konqueror preloading works only
270270+ # with full KDE running). The KDE_FULL_SESSION property can be detected by
271271+ # any X client connected to the same X session, even if not launched
272272+@@ -318,11 +285,11 @@ fi
273273+ #
274274+ KDE_FULL_SESSION=true
275275+ export KDE_FULL_SESSION
276276+-xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
277277++@xprop@ -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
278278+279279+ KDE_SESSION_VERSION=5
280280+ export KDE_SESSION_VERSION
281281+-xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
282282++@xprop@ -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
283283+284284+ KDE_SESSION_UID=`id -ru`
285285+ export KDE_SESSION_UID
286286+@@ -332,11 +299,11 @@ export XDG_CURRENT_DESKTOP
287287+288288+ # At this point all the environment is ready, let's send it to kwalletd if running
289289+ if test -n "$PAM_KWALLET_LOGIN" ; then
290290+- env | socat STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN
291291++ env | @socat@ STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN
292292+ fi
293293+ # ...and also to kwalletd5
294294+ if test -n "$PAM_KWALLET5_LOGIN" ; then
295295+- env | socat STDIN UNIX-CONNECT:$PAM_KWALLET5_LOGIN
296296++ env | @socat@ STDIN UNIX-CONNECT:$PAM_KWALLET5_LOGIN
297297+ fi
298298+299299+ # At this point all environment variables are set, let's send it to the DBus session server to update the activation environment
300300+@@ -349,18 +316,18 @@ if test $? -ne 0; then
301301+ # Startup error
302302+ echo 'startkde: Could not sync environment to dbus.' 1>&2
303303+ test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
304304+- xmessage -geometry 500x100 "Could not sync environment to dbus."
305305++ @xmessage@ -geometry 500x100 "Could not sync environment to dbus."
306306+ exit 1
307307+ fi
308308+309309+ # We set LD_BIND_NOW to increase the efficiency of kdeinit.
310310+ # kdeinit unsets this variable before loading applications.
311311+-LD_BIND_NOW=true @CMAKE_INSTALL_FULL_LIBEXECDIR_KF5@/start_kdeinit_wrapper --kded +kcminit_startup
312312++LD_BIND_NOW=true @start_kdeinit_wrapper@ --kded +kcminit_startup
313313+ if test $? -ne 0; then
314314+ # Startup error
315315+ echo 'startkde: Could not start kdeinit5. Check your installation.' 1>&2
316316+ test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
317317+- xmessage -geometry 500x100 "Could not start kdeinit5. Check your installation."
318318++ @xmessage@ -geometry 500x100 "Could not start kdeinit5. Check your installation."
319319+ exit 1
320320+ fi
321321+322322+@@ -379,27 +346,27 @@ test -n "$KDEWM" && KDEWM="--windowmanag
323323+ # lock now and do the rest of the KDE startup underneath the locker.
324324+ KSMSERVEROPTIONS=""
325325+ test -n "$dl" && KSMSERVEROPTIONS=" --lockscreen"
326326+-kwrapper5 @CMAKE_INSTALL_FULL_BINDIR@/ksmserver $KDEWM $KSMSERVEROPTIONS
327327++@kwrapper5@ @CMAKE_INSTALL_FULL_BINDIR@/ksmserver $KDEWM $KSMSERVEROPTIONS
328328+ if test $? -eq 255; then
329329+ # Startup error
330330+ echo 'startkde: Could not start ksmserver. Check your installation.' 1>&2
331331+ test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
332332+- xmessage -geometry 500x100 "Could not start ksmserver. Check your installation."
333333++ @xmessage@ -geometry 500x100 "Could not start ksmserver. Check your installation."
334334+ fi
335335+336336+-wait_drkonqi=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true`
337337++wait_drkonqi=`@kreadconfig5@ --file startkderc --group WaitForDrKonqi --key Enabled --default true`
338338+339339+ if test x"$wait_drkonqi"x = x"true"x ; then
340340+ # wait for remaining drkonqi instances with timeout (in seconds)
341341+- wait_drkonqi_timeout=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
342342++ wait_drkonqi_timeout=`@kreadconfig5@ --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
343343+ wait_drkonqi_counter=0
344344+- while $qdbus | grep "^[^w]*org.kde.drkonqi" > /dev/null ; do
345345++ while @qdbus@ | @grep@ "^[^w]*org.kde.drkonqi" > /dev/null ; do
346346+ sleep 5
347347+ wait_drkonqi_counter=$((wait_drkonqi_counter+5))
348348+ if test "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ; then
349349+ # ask remaining drkonqis to die in a graceful way
350350+- $qdbus | grep 'org.kde.drkonqi-' | while read address ; do
351351+- $qdbus "$address" "/MainApplication" "quit"
352352++ @qdbus@ | @grep@ 'org.kde.drkonqi-' | while read address ; do
353353++ @qdbus@ "$address" "/MainApplication" "quit"
354354+ done
355355+ break
356356+ fi
357357+@@ -411,12 +378,12 @@ echo 'startkde: Shutting down...' 1>&2
358358+ test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
359359+360360+ # Clean up
361361+-kdeinit5_shutdown
362362++@kdeinit5_shutdown@
363363+364364+ unset KDE_FULL_SESSION
365365+-xprop -root -remove KDE_FULL_SESSION
366366++@xprop@ -root -remove KDE_FULL_SESSION
367367+ unset KDE_SESSION_VERSION
368368+-xprop -root -remove KDE_SESSION_VERSION
369369++@xprop@ -root -remove KDE_SESSION_VERSION
370370+ unset KDE_SESSION_UID
371371+372372+ echo 'startkde: Done.' 1>&2