kde5.plasma-workspace: propagate inputs automatically

This commit is contained in:
Thomas Tuegel 2016-01-31 17:02:17 -06:00
parent 30d6a71995
commit a7ae370fa3
2 changed files with 65 additions and 46 deletions

View File

@ -11,7 +11,7 @@
, xprop, xrdb, xset, xsetroot, solid, qtquickcontrols
}:
plasmaPackage rec {
plasmaPackage {
name = "plasma-workspace";
nativeBuildInputs = [
@ -20,10 +20,11 @@ plasmaPackage rec {
makeQtWrapper
];
buildInputs = [
kcmutils kcrash kdbusaddons kdesu kdewebkit kjsembed knewstuff
knotifyconfig kpackage ktextwidgets kwallet kwayland kxmlrpcclient
libdbusmenu libSM libXcursor networkmanager-qt pam phonon
qtscript wayland
dbus_tools kcmutils kconfig kcrash kdbusaddons kdesu kdewebkit
kinit kjsembed knewstuff knotifyconfig kpackage kservice
ktextwidgets kwallet kwayland kxmlrpcclient libdbusmenu libSM
libXcursor mkfontdir networkmanager-qt pam phonon qtscript qttools
socat wayland xmessage xprop xset xsetroot
];
propagatedBuildInputs = [
baloo kactivities kdeclarative kdelibs4support kglobalaccel
@ -32,11 +33,29 @@ plasmaPackage rec {
];
patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
inherit bash coreutils gnused gnugrep socat;
inherit kconfig kinit kservice qttools;
inherit dbus_tools mkfontdir xmessage xprop xrdb xset xsetroot;
postPatch = ''
substituteAllInPlace startkde/startkde.cmake
substituteInPlace startkde/startkde.cmake \
--subst-var-by bash $(type -P bash) \
--subst-var-by sed $(type -P sed) \
--subst-var-by grep $(type -P grep) \
--subst-var-by socat $(type -P socat) \
--subst-var-by kcheckrunning $(type -P kcheckrunning) \
--subst-var-by xmessage $(type -P xmessage) \
--subst-var-by tr $(type -P tr) \
--subst-var-by qtpaths $(type -P qtpaths) \
--subst-var-by qdbus $(type -P qdbus) \
--subst-var-by dbus-launch $(type -P dbus-launch) \
--subst-var-by mkfontdir $(type -P mkfontdir) \
--subst-var-by xset $(type -P xset) \
--subst-var-by xsetroot $(type -P xsetroot) \
--subst-var-by xprop $(type -P xprop) \
--subst-var-by start_kdeinit_wrapper "${kinit.out}/lib/libexec/kf5/start_kdeinit_wrapper" \
--subst-var-by kwrapper5 $(type -P kwrapper5) \
--subst-var-by kdeinit5_shutdown $(type -P kdeinit5_shutdown) \
--subst-var-by kbuildsycoca5 $(type -P kbuildsycoca5) \
--subst-var-by kreadconfig5 $(type -P kreadconfig5) \
--subst-var out
substituteInPlace startkde/kstartupconfig/kstartupconfig.cpp \
--replace kdostartupconfig5 $out/bin/kdostartupconfig5
'';

View File

@ -4,7 +4,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
+++ plasma-workspace-5.5.1/startkde/startkde.cmake
@@ -1,8 +1,31 @@
-#!/bin/sh
+#!@bash@/bin/bash
+#!@bash@
#
# DEFAULT KDE STARTUP SCRIPT ( @PROJECT_VERSION@ )
#
@ -29,7 +29,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
+# in Trolltech.conf. A better solution would be to stop
+# Qt from doing this wackiness in the first place.
+if [ -e $HOME/.config/Trolltech.conf ]; then
+ @gnused@/bin/sed -e '/nix\\store\|nix\/store/ d' -i $HOME/.config/Trolltech.conf
+ @sed@ -e '/nix\\store\|nix\/store/ d' -i $HOME/.config/Trolltech.conf
+fi
+
if test "x$1" = x--failsafe; then
@ -54,13 +54,13 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
-
# Check if a KDE session already is running and whether it's possible to connect to X
-kcheckrunning
+@out@/bin/kcheckrunning
+@kcheckrunning@
kcheckrunning_result=$?
if test $kcheckrunning_result -eq 0 ; then
- echo "KDE seems to be already running on this display."
- xmessage -geometry 500x100 "KDE seems to be already running on this display." > /dev/null 2>/dev/null
+ echo "KDE seems to be already running on this display."
+ @xmessage@/bin/xmessage -geometry 500x100 "KDE seems to be already running on this display."
+ @xmessage@ -geometry 500x100 "KDE seems to be already running on this display."
exit 1
elif test $kcheckrunning_result -eq 2 ; then
echo "\$DISPLAY is not set or cannot connect to the X server."
@ -80,7 +80,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
-fi
-
-mkdir -p $configDir
+configDir=$(@qttools@/bin/qtpaths --writable-path GenericConfigLocation)
+configDir=$(@qtpaths@ --writable-path GenericConfigLocation)
+mkdir -p "$configDir"
#This is basically setting defaults so we can use them with kstartupconfig5
@ -126,7 +126,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
returncode=$?
if test $returncode -ne 0; then
- xmessage -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
+ @xmessage@/bin/xmessage -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
+ @xmessage@ -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
exit 1
fi
[ -r $configDir/startupconfig ] && . $configDir/startupconfig
@ -134,7 +134,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
export QT_DEVICE_PIXEL_RATIO=$kdeglobals_kscreen_scalefactor
fi
+XCURSOR_PATH=~/.icons:$(echo "$XDG_DATA_DIRS" | @coreutils@/bin/tr ":" "\n" | @gnused@/bin/sed 's,$,/icons,g' | @coreutils@/bin/tr "\n" ":")
+XCURSOR_PATH=~/.icons:$(echo "$XDG_DATA_DIRS" | @tr@ ":" "\n" | @sed@ 's,$,/icons,g' | @tr@ "\n" ":")
+export XCURSOR_PATH
+
# XCursor mouse theme needs to be applied here to work even for kded or ksmserver
@ -160,7 +160,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
+# If the user has overwritten fonts, the cursor font may be different now
+# so don't move this up.
+#
+@xsetroot@/bin/xsetroot -cursor_name left_ptr
+@xsetroot@ -cursor_name left_ptr
dl=$DESKTOP_LOCKED
unset DESKTOP_LOCKED # Don't want it in the environment
@ -168,14 +168,14 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
+# Make sure that D-Bus is running
+# D-Bus autolaunch is broken
+if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
+ eval `@dbus_tools@/bin/dbus-launch --sh-syntax --exit-with-session`
+ eval `@dbus-launch@ --sh-syntax --exit-with-session`
+fi
+if @qttools@/bin/qdbus >/dev/null 2>/dev/null; then
+if @qdbus@ >/dev/null 2>/dev/null; then
+ : # ok
+else
+ echo 'startkde: Could not start D-Bus. Can you call qdbus?' 1>&2
+ test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+ @xmessage@/bin/xmessage -geometry 500x100 "Could not start D-Bus. Can you call qdbus?"
+ @xmessage@ -geometry 500x100 "Could not start D-Bus. Can you call qdbus?"
+ exit 1
+fi
+
@ -195,7 +195,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
-# TODO: Use GenericConfigLocation once we depend on Qt 5.4
-scriptpath=`qtpaths --paths ConfigLocation | tr ':' '\n' | sed 's,$,/plasma-workspace,g'`
+scriptpath=$(@qttools@/bin/qtpaths --paths GenericConfigLocation | tr ':' '\n' | @gnused@/bin/sed 's,$,/plasma-workspace,g')
+scriptpath=$(@qtpaths@ --paths GenericConfigLocation | tr ':' '\n' | @sed@ 's,$,/plasma-workspace,g')
# Add /env/ to the directory to locate the scripts to be sourced
for prefix in `echo $scriptpath`; do
@ -204,7 +204,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
if test -n "$KDEDIRS"; then
- kdedirs_first=`echo "$KDEDIRS"|sed -e 's/:.*//'`
+ kdedirs_first=`echo "$KDEDIRS" | @gnused@/bin/sed -e 's/:.*//'`
+ kdedirs_first=`echo "$KDEDIRS" | @sed@ -e 's/:.*//'`
sys_odir=$kdedirs_first/share/fonts/override
sys_fdir=$kdedirs_first/share/fonts
else
@ -216,10 +216,10 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
-test -d "$usr_odir" && (mkfontdir "$usr_odir" ; xset +fp "$usr_odir")
-test -d "$usr_fdir" && (mkfontdir "$usr_fdir" ; xset fp+ "$usr_fdir")
-test -d "$sys_fdir" && xset fp+ "$sys_fdir"
+test -d "$sys_odir" && @xset@/bin/xset +fp "$sys_odir"
+test -d "$usr_odir" && ( @mkfontdir@/bin/mkfontdir "$usr_odir" ; @xset@/bin/xset +fp "$usr_odir" )
+test -d "$usr_fdir" && ( @mkfontdir@/bin/mkfontdir "$usr_fdir" ; @xset@/bin/xset fp+ "$usr_fdir" )
+test -d "$sys_fdir" && @xset@/bin/xset fp+ "$sys_fdir"
+test -d "$sys_odir" && @xset@ +fp "$sys_odir"
+test -d "$usr_odir" && ( @mkfontdir@ "$usr_odir" ; @xset@ +fp "$usr_odir" )
+test -d "$usr_fdir" && ( @mkfontdir@ "$usr_fdir" ; @xset@ fp+ "$usr_fdir" )
+test -d "$sys_fdir" && @xset@ fp+ "$sys_fdir"
# Ask X11 to rebuild its font list.
-xset fp rehash
@ -233,7 +233,7 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
-# so don't move this up.
-#
-xsetroot -cursor_name left_ptr
+@xset@/bin/xset fp rehash
+@xset@ fp rehash
# Get Ghostscript to look into user's KDE fonts dir for additional Fontmap
if test -n "$GS_LIB" ; then
@ -269,12 +269,12 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
KDE_FULL_SESSION=true
export KDE_FULL_SESSION
-xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
+@xprop@/bin/xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
+@xprop@ -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
KDE_SESSION_VERSION=5
export KDE_SESSION_VERSION
-xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
+@xprop@/bin/xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
+@xprop@ -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
KDE_SESSION_UID=`id -ru`
export KDE_SESSION_UID
@ -283,12 +283,12 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
# 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
+ env | @socat@/bin/socat STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN
+ env | @socat@ STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN
fi
# ...and also to kwalletd5
if test -n "$PAM_KWALLET5_LOGIN" ; then
- env | socat STDIN UNIX-CONNECT:$PAM_KWALLET5_LOGIN
+ env | @socat@/bin/socat STDIN UNIX-CONNECT:$PAM_KWALLET5_LOGIN
+ env | @socat@ STDIN UNIX-CONNECT:$PAM_KWALLET5_LOGIN
fi
# At this point all environment variables are set, let's send it to the DBus session server to update the activation environment
@ -297,27 +297,27 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
echo 'startkde: Could not sync environment to dbus.' 1>&2
test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
- xmessage -geometry 500x100 "Could not sync environment to dbus."
+ @xmessage@/bin/xmessage -geometry 500x100 "Could not sync environment to dbus."
+ @xmessage@ -geometry 500x100 "Could not sync environment to dbus."
exit 1
fi
# We set LD_BIND_NOW to increase the efficiency of kdeinit.
# kdeinit unsets this variable before loading applications.
-LD_BIND_NOW=true @CMAKE_INSTALL_FULL_LIBEXECDIR_KF5@/start_kdeinit_wrapper --kded +kcminit_startup
+LD_BIND_NOW=true @kinit@/lib/libexec/kf5/start_kdeinit_wrapper --kded +kcminit_startup
+LD_BIND_NOW=true @start_kdeinit_wrapper@ --kded +kcminit_startup
if test $? -ne 0; then
# Startup error
echo 'startkde: Could not start kdeinit5. Check your installation.' 1>&2
test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
- xmessage -geometry 500x100 "Could not start kdeinit5. Check your installation."
+ @xmessage@/bin/xmessage -geometry 500x100 "Could not start kdeinit5. Check your installation."
+ @xmessage@ -geometry 500x100 "Could not start kdeinit5. Check your installation."
exit 1
fi
+# (NixOS) We run kbuildsycoca5 before starting the user session because things
+# may be missing or moved if they have run nixos-rebuild and it may not be
+# possible for them to start Konsole to run it manually!
+@kservice@/bin/kbuildsycoca5
+@kbuildsycoca5@
+
# finally, give the session control to the session manager
# see kdebase/ksmserver for the description of the rest of the startup sequence
@ -327,33 +327,33 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
KSMSERVEROPTIONS=""
test -n "$dl" && KSMSERVEROPTIONS=" --lockscreen"
-kwrapper5 @CMAKE_INSTALL_FULL_BINDIR@/ksmserver $KDEWM $KSMSERVEROPTIONS
+@kinit@/bin/kwrapper5 @CMAKE_INSTALL_FULL_BINDIR@/ksmserver $KDEWM $KSMSERVEROPTIONS
+@kwrapper5@ @CMAKE_INSTALL_FULL_BINDIR@/ksmserver $KDEWM $KSMSERVEROPTIONS
if test $? -eq 255; then
# Startup error
echo 'startkde: Could not start ksmserver. Check your installation.' 1>&2
test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
- xmessage -geometry 500x100 "Could not start ksmserver. Check your installation."
+ @xmessage@/bin/xmessage -geometry 500x100 "Could not start ksmserver. Check your installation."
+ @xmessage@ -geometry 500x100 "Could not start ksmserver. Check your installation."
fi
-wait_drkonqi=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true`
+wait_drkonqi=`@kconfig@/bin/kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true`
+wait_drkonqi=`@kreadconfig5@ --file startkderc --group WaitForDrKonqi --key Enabled --default true`
if test x"$wait_drkonqi"x = x"true"x ; then
# wait for remaining drkonqi instances with timeout (in seconds)
- wait_drkonqi_timeout=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
+ wait_drkonqi_timeout=`@kconfig@/bin/kreadconfig5 --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
+ wait_drkonqi_timeout=`@kreadconfig5@ --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
wait_drkonqi_counter=0
- while $qdbus | grep "^[^w]*org.kde.drkonqi" > /dev/null ; do
+ while @qttools@/bin/qdbus | @gnugrep@/bin/grep "^[^w]*org.kde.drkonqi" > /dev/null ; do
+ while @qdbus@ | @grep@ "^[^w]*org.kde.drkonqi" > /dev/null ; do
sleep 5
wait_drkonqi_counter=$((wait_drkonqi_counter+5))
if test "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ; then
# ask remaining drkonqis to die in a graceful way
- $qdbus | grep 'org.kde.drkonqi-' | while read address ; do
- $qdbus "$address" "/MainApplication" "quit"
+ @qttools@/bin/qdbus | @gnugrep@/bin/grep 'org.kde.drkonqi-' | while read address ; do
+ @qttools@/bin/qdbus "$address" "/MainApplication" "quit"
+ @qdbus@ | @grep@ 'org.kde.drkonqi-' | while read address ; do
+ @qdbus@ "$address" "/MainApplication" "quit"
done
break
fi
@ -362,14 +362,14 @@ Index: plasma-workspace-5.5.1/startkde/startkde.cmake
# Clean up
-kdeinit5_shutdown
+@kinit@/bin/kdeinit5_shutdown
+@kdeinit5_shutdown@
unset KDE_FULL_SESSION
-xprop -root -remove KDE_FULL_SESSION
+@xprop@/bin/xprop -root -remove KDE_FULL_SESSION
+@xprop@ -root -remove KDE_FULL_SESSION
unset KDE_SESSION_VERSION
-xprop -root -remove KDE_SESSION_VERSION
+@xprop@/bin/xprop -root -remove KDE_SESSION_VERSION
+@xprop@ -root -remove KDE_SESSION_VERSION
unset KDE_SESSION_UID
echo 'startkde: Done.' 1>&2