Skip to content

Instantly share code, notes, and snippets.

@whitequark
Last active April 20, 2024 10:01
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whitequark/8854594df21508030f06 to your computer and use it in GitHub Desktop.
Save whitequark/8854594df21508030f06 to your computer and use it in GitHub Desktop.
.xsession that starts up a minimal plasma-less KDE 5 environment with i3wm
#!/bin/sh
truncate -s0 ${HOME}/.xsession-errors
configDir=${HOME}/.config
mkdir -p $configDir
cat >$configDir/startupconfigkeys <<EOF
kcminputrc Mouse cursorTheme 'breeze_cursors'
kcminputrc Mouse cursorSize ''
ksplashrc KSplash Theme Breeze
ksplashrc KSplash Engine KSplashQML
kdeglobals KScreen ScreenScaleFactors ''
kcmfonts General forceFontDPI 0
EOF
kdeglobalsfile=$configDir/kdeglobals
test -f $kdeglobalsfile || {
cat >$kdeglobalsfile <<EOF
[General]
XftAntialias=true
XftHintStyle=hintmedium
XftSubPixel=none
EOF
}
[ -r $configDir/startupconfig ] && . $configDir/startupconfig
if [ "$kdeglobals_kscreen_screenscalefactors" ]; then
export QT_SCREEN_SCALE_FACTORS="$kdeglobals_kscreen_screenscalefactors"
fi
export QT_AUTO_SCREEN_SCALE_FACTOR=0
if test -n "$kcminputrc_mouse_cursortheme" -o -n "$kcminputrc_mouse_cursorsize" ; then
kapplymousetheme "$kcminputrc_mouse_cursortheme" "$kcminputrc_mouse_cursorsize"
if test $? -eq 10; then
XCURSOR_THEME=breeze_cursors
export XCURSOR_THEME
elif test -n "$kcminputrc_mouse_cursortheme"; then
XCURSOR_THEME="$kcminputrc_mouse_cursortheme"
export XCURSOR_THEME
fi
if test -n "$kcminputrc_mouse_cursorsize"; then
XCURSOR_SIZE="$kcminputrc_mouse_cursorsize"
export XCURSOR_SIZE
fi
fi
if test "$kcmfonts_general_forcefontdpi" -ne 0; then
xrdb -quiet -merge -nocpp <<EOF
Xft.dpi: $kcmfonts_general_forcefontdpi
EOF
fi
ksplash_pid=
case "$ksplashrc_ksplash_engine" in
KSplashQML)
ksplash_pid=`ksplashqml "${ksplashrc_ksplash_theme}" --pid`
;;
None)
;;
*)
;;
esac
for file in $configDir/plasma-workspace/env/*.sh; do
test -r "$file" && . "$file" || true
done
xsetroot -cursor_name left_ptr
usr_odir=$HOME/.fonts/kde-override
usr_fdir=$HOME/.fonts
if test -n "$KDEDIRS"; then
kdedirs_first=`echo "$KDEDIRS"|sed -e 's/:.*//'`
sys_odir=$kdedirs_first/share/fonts/override
sys_fdir=$kdedirs_first/share/fonts
else
sys_odir=$KDEDIR/share/fonts/override
sys_fdir=$KDEDIR/share/fonts
fi
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"
xset fp rehash
if test -n "$GS_LIB" ; then
GS_LIB=$usr_fdir:$GS_LIB
export GS_LIB
else
GS_LIB=$usr_fdir
export GS_LIB
fi
if test -z "$XDG_DATA_DIRS"; then
XDG_DATA_DIRS="/usr/share:/usr/share:/usr/local/share"
fi
export XDG_DATA_DIRS
KDE_FULL_SESSION=true
export KDE_FULL_SESSION
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
KDE_SESSION_UID=`id -ru`
export KDE_SESSION_UID
XDG_CURRENT_DESKTOP=KDE
export XDG_CURRENT_DESKTOP
GTK_USE_PORTAL=1
export GTK_USE_PORTAL
dbus-update-activation-environment --systemd --all
if test $? -ne 0; then
test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
xmessage -geometry 500x100 "Could not sync environment to dbus."
exit 1
fi
LD_BIND_NOW=true /usr/lib/x86_64-linux-gnu/libexec/kf5/start_kdeinit_wrapper --kded +kcminit_startup
if test $? -ne 0; then
test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
xmessage -geometry 500x100 "Could not start kdeinit5."
exit 1
fi
kwrapper5 /usr/bin/ksmserver &
if test $? -eq 255; then
test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
xmessage -geometry 500x100 "Could not start ksmserver."
fi
/usr/lib/x86_64-linux-gnu/libexec/org_kde_powerdevil &
plasmashell &
i3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment