feat(desktop): start kde plasma on nested kwin when chosen

This commit is contained in:
xXJsonDeruloXx committed 2026-09-28 18:54:44 -04:00
1 parent af78a840f0
commit 4dc1141e5e
3 files changed
+117

No files matched your search

+11
View File
@@ -130,6 +130,17 @@ python3 /usr/local/bin/bannerlator-pad-defaults 2>&1 | sed 's/^/[pads] /'
gpu_entries() { python3 /usr/local/bin/droiddeck-desktop-gpu 2>&1 | sed 's/^/[gpu] /'; }
gpu_entries
# KDE Plasma picked in the Desktop settings (BL_DESKTOP_SHELL): KWin takes labwc's place. It
# composites in software, so the menu's entries go full screen on the GPU as they do on pixman.
if [ "${BL_DESKTOP_SHELL:-lxqt}" = plasma ]; then
if [ -x /usr/bin/kwin_wayland ] && [ -x /usr/local/bin/droiddeck-plasma ]; then
use_renderer pixman
gpu_entries
exec /usr/local/bin/droiddeck-plasma
fi
echo "== droiddeck-desktop: KDE Plasma is not installed; starting LXQt"
fi
# ~/.droiddeck-desktop-debug: labwc's own debug log (views and layer surfaces mapping) too. The GPU
# renderers are experimental and always log in full, so a desktop that does not come up says why.
DEBUG=; { [ -f "$HOME/.droiddeck-desktop-debug" ] || [ "$WLR_RENDERER" != pixman ]; } && DEBUG=-d
+81
View File
@@ -0,0 +1,81 @@
#!/bin/bash
# KDE Plasma as the desktop: KWin nested as a client of the app's compositor (its Wayland backend,
# chosen because WAYLAND_DISPLAY names the app's socket), with Plasma's session on it and Xwayland
# for the X11 programs. Started by droiddeck-desktop when the Desktop settings pick KDE Plasma and
# the plasma package is in; what droiddeck-desktop prepares (the log, fonts, the menu's game and
# emulator entries, controller defaults) is done by then. If KWin does not come up, the desktop
# starts on LXQt instead and the log says why.
# Staged by the app on every launch, like droiddeck-desktop.
set -u
export XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=KDE XDG_SESSION_DESKTOP=KDE
export KDE_FULL_SESSION=true KDE_SESSION_VERSION=6
# Plasma's own platform theme (plasma-integration), not LXQt's.
unset QT_QPA_PLATFORMTHEME WLR_RENDERER WLR_BACKENDS
export QT_QPA_PLATFORM="wayland;xcb"
# KWin composites in software (QPainter): its OpenGL path allocates through gbm on a DRM render node,
# which the KGSL stand-in is not - the same wall stock wlroots hit. QPainter hands programs shm
# buffers only, so games and emulators from the menu open full screen on the GPU through
# droiddeck-gpu, as on LXQt's pixman. BL_KWIN_COMPOSE (O2, Q) overrides for experiments.
export KWIN_COMPOSE=${BL_KWIN_COMPOSE:-Q}
echo "== droiddeck-plasma: KWin ($KWIN_COMPOSE) nested on $WAYLAND_DISPLAY at ${BL_WIDTH:-1280}x${BL_HEIGHT:-720}"
# Settings Plasma reads at start, written every session: no splash, no systemd boot (there is no
# systemd user instance in proot), no screen locker (it needs PAM and a greeter), no wallet
# prompts, no file indexer eating the cores a game needs.
kset() { kwriteconfig6 --file "$1" --group "$2" --key "$3" "$4" 2>/dev/null; }
kset ksplashrc KSplash Engine none
kset ksplashrc KSplash Theme None
kset startkderc General systemdBoot false
kset kscreenlockerrc Daemon Autolock false
kset kscreenlockerrc Daemon LockOnResume false
kset kwalletrc Wallet Enabled false
kset baloofilerc "Basic Settings" "Indexing-Enabled" false
# The nested output is the app's surface: no scaling, the app already sized it.
kset kwinrc Xwayland Scale 1
SOCKET=wayland-1
rm -f "$XDG_RUNTIME_DIR/$SOCKET" "$XDG_RUNTIME_DIR/$SOCKET.lock"
run_kwin() {
local args=(--socket "$SOCKET" --width "${BL_WIDTH:-1280}" --height "${BL_HEIGHT:-720}" --scale 1
--xwayland --no-lockscreen --exit-with-session /usr/local/bin/droiddeck-plasma-session)
# A session bus: kded, plasmashell and the portal all live on it.
if command -v dbus-run-session >/dev/null 2>&1; then
dbus-run-session -- kwin_wayland "${args[@]}"
else
kwin_wayland "${args[@]}"
fi
}
kwin_answers() { WAYLAND_DISPLAY=$SOCKET timeout 3 wayland-info >/dev/null 2>&1; }
pids_named() {
local p
for p in /proc/[0-9]*; do
[ "$(cat "$p/comm" 2>/dev/null)" = "$1" ] && echo "${p#/proc/}"
done
}
fall_back() {
echo "== droiddeck-plasma: $1; starting LXQt instead"
for prog in plasmashell kded6 ksmserver kwin_wayland Xwayland; do kill -KILL $(pids_named "$prog") 2>/dev/null; done
find "$XDG_RUNTIME_DIR" -mindepth 1 -maxdepth 1 ! -name 'wayland-0*' ! -name 'keymap.xkb' -exec rm -rf {} + 2>/dev/null
BL_DESKTOP_SHELL=lxqt exec /usr/local/bin/droiddeck-desktop
}
started=$(date +%s)
run_kwin &
kwin_job=$!
answered=
while kill -0 "$kwin_job" 2>/dev/null; do
if kwin_answers; then answered=1; break; fi
[ $(( $(date +%s) - started )) -ge 30 ] && break
sleep 1
done
if [ -z "$answered" ]; then
if kill -0 "$kwin_job" 2>/dev/null; then
kill -TERM $(pids_named kwin_wayland) 2>/dev/null
sleep 2
fall_back "KWin did not answer in 30 s"
fi
wait "$kwin_job"
fall_back "KWin exited at start (exit $?)"
fi
echo "== droiddeck-plasma: KWin is up after $(( $(date +%s) - started )) s"
wait "$kwin_job"
@@ -0,0 +1,25 @@
#!/bin/bash
# What runs inside KWin for the Plasma desktop (droiddeck-plasma's --exit-with-session): the Steam
# client if the desktop was asked for with Steam in it, then Plasma's own session. KWin, and with it
# the desktop, ends when this does.
# The desktop was asked for with Steam in it (the front end's "Steam Desktop UI", Big Picture's
# "Switch to Desktop"): the client's desktop UI, as LXQt's autostart opens it.
if [ "${BL_DESKTOP_STEAM:-0}" = 1 ]; then
/usr/local/bin/bannerlator-steam-launch desktop 2>&1 | sed 's/^/[steam] /' &
fi
# The desktop's wallpaper once, on the first Plasma start; after that it is the user's to change.
if [ ! -f "$HOME/.config/.droiddeck-plasma-wallpaper" ] && [ -f /usr/share/backgrounds/steamdeck.png ]; then
( set -o pipefail; sleep 8
plasma-apply-wallpaperimage /usr/share/backgrounds/steamdeck.png 2>&1 | sed 's/^/[wallpaper] /' \
&& touch "$HOME/.config/.droiddeck-plasma-wallpaper" ) &
fi
for session in /usr/lib/startplasma-waylandsession /usr/libexec/startplasma-waylandsession; do
if [ -x "$session" ]; then
echo "== droiddeck-plasma: $session"
"$session" 2>&1 | sed 's/^/[plasma] /'
exit "${PIPESTATUS[0]}"
fi
done
echo "== droiddeck-plasma: no startplasma-waylandsession; plasmashell on its own"
plasmashell 2>&1 | sed 's/^/[plasmashell] /'
exit "${PIPESTATUS[0]}"