Add KDE Plasma Mobile desktop option

This commit is contained in:
xXJsonDeruloXx committed 2026-09-26 08:30:19 -04:00
1 parent dc1816612c
commit 70d3d1f6a4
29 files changed
+1177 -83

No files matched your search

+2 -1
View File
@@ -113,6 +113,7 @@ docker run --rm --platform linux/amd64 \
[ -f "$f" ] && install -Dm644 "$f" "$d/${f#tools/linuxfs/overlay/}"
done
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop "$d/usr/local/bin/droiddeck-desktop"
install -Dm644 tools/linuxfs/desktop/droiddeck-plasma-mobile "$d/usr/local/bin/droiddeck-plasma-mobile"
install -Dm644 tools/linuxfs/desktop/droiddeck-gpu "$d/usr/local/bin/droiddeck-gpu"
install -Dm644 tools/linuxfs/desktop/droiddeck-desktop-gpu "$d/usr/local/bin/droiddeck-desktop-gpu"
install -Dm644 tools/linuxfs/desktop/autostart "$d/etc/xdg/labwc/autostart"
@@ -290,7 +291,7 @@ rm -f "${apk}.aligned" "${apk}.idsig"
signature_output=$("${build_tools}/apksigner" verify --min-sdk-version 21 --verbose --print-certs "${apk}")
printf '%s\n' "${signature_output}"
if ! unzip -l "${apk}" | grep -qE 'META-INF/.*\.(SF|RSA|DSA)$'; then
if ! unzip -l "${apk}" | grep -E 'META-INF/.*\.(SF|RSA|DSA)$' >/dev/null; then
echo "APK signature check failed: JAR signature files are missing." >&2
exit 1
fi
@@ -0,0 +1,111 @@
#!/bin/bash
# Run Plasma Mobile inside a nested KWin Wayland session.
set -u
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=KDE
export XDG_CURRENT_DESKTOP=KDE
export QT_QPA_PLATFORM=wayland
export QT_QPA_PLATFORMTHEME=KDE
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export EGL_PLATFORM=wayland
export QT_QUICK_CONTROLS_STYLE=org.kde.breeze
export QT_ENABLE_GLYPH_CACHE_WORKAROUND=1
export QT_QUICK_CONTROLS_MOBILE=1
export KSCREEN_BACKEND=QScreen
export KDE_FULL_SESSION=1
export KDE_SESSION_VERSION=6
export PLASMA_INTEGRATION_USE_PORTAL=1
export PLASMA_PLATFORM=phone:handset
export PLASMA_DEFAULT_SHELL=org.kde.plasma.mobileshell
export XDG_CONFIG_DIRS="$HOME/.config/plasma-mobile:/etc/xdg:${XDG_CONFIG_DIRS:-}"
export GDK_BACKEND=wayland,x11
export SDL_VIDEODRIVER=wayland,x11
if [ -n "${BL_DEBUG_DIR:-}" ]; then
mkdir -p "$BL_DEBUG_DIR" 2>/dev/null || true
exec >>"$BL_DEBUG_DIR/desktop.log" 2>&1
echo "== droiddeck-plasma-mobile $(date -u '+%Y-%m-%d %H:%M:%S UTC') ${BL_WIDTH:-1280}x${BL_HEIGHT:-720}"
fi
if ! command -v plasmashell >/dev/null 2>&1 || ! command -v dbus-run-session >/dev/null 2>&1; then
echo "== Plasma Mobile packages are missing; choose KDE Plasma Mobile in Desktop settings and start Desktop once"
exit 66
fi
plasma_log="${BL_DEBUG_DIR:-/tmp}/plasma.log"
echo "== Plasma $(plasmashell --version 2>&1)"
echo "== Wayland display ${WAYLAND_DISPLAY:-wayland-0}; XDG runtime $XDG_RUNTIME_DIR"
mkdir -p /tmp || exit 73
chmod 1777 /tmp || echo "== could not set standard temporary-directory permissions"
export TMPDIR=/tmp
echo "== temporary directories: $(ls -ld /tmp /dev/shm 2>&1)"
echo "== preparing the KDE Plasma Mobile Wayland session"
: >"$plasma_log"
# Gamescope's Zink override is for game clients. KWin owns the Plasma Mobile session and presents
# one nested Wayland window through Bannerlator's host compositor.
export QT_QUICK_BACKEND=software
unset MESA_LOADER_DRIVER_OVERRIDE GALLIUM_DRIVER LIBGL_KOPPER_DRI2 ZINK_DESCRIPTORS mesa_glthread MESA_NO_ERROR
# The PRoot guest has no systemd user manager. Hide only its session-bus activation entry while
# KDE starts, and restore it on every exit.
systemd_dbus_service=/usr/share/dbus-1/services/org.freedesktop.systemd1.service
systemd_dbus_service_disabled="$systemd_dbus_service.droiddeck-disabled"
restore_systemd_dbus_service() {
if [ -e "$systemd_dbus_service_disabled" ] && [ ! -e "$systemd_dbus_service" ]; then
mv "$systemd_dbus_service_disabled" "$systemd_dbus_service" || echo "== could not restore systemd D-Bus service file"
fi
}
restore_systemd_dbus_service
if [ -f "$systemd_dbus_service" ]; then
mv "$systemd_dbus_service" "$systemd_dbus_service_disabled" || echo "== could not disable session-bus activation for systemd1"
fi
trap restore_systemd_dbus_service EXIT
dbus-run-session -- sh -c '
export WAYLAND_DISPLAY=wayland-0
width=${BL_WIDTH:-1280}
height=${BL_HEIGHT:-720}
rm -f "$XDG_RUNTIME_DIR/wayland-1" "$XDG_RUNTIME_DIR/wayland-1.lock"
echo "== starting nested KWin on wayland-0 (${width}x${height}), socket wayland-1"
kwin_wayland \
--wayland-display=wayland-0 \
--socket=wayland-1 \
--width="$width" --height="$height" --fullscreen \
--no-lockscreen --no-global-shortcuts --no-kactivities \
>"$plasma_log" 2>&1 &
kwin_pid=$!
plasmashell_pid=
cleanup() {
if [ -n "$plasmashell_pid" ]; then kill "$plasmashell_pid" 2>/dev/null || true; fi
if [ -n "$kwin_pid" ]; then kill "$kwin_pid" 2>/dev/null || true; wait "$kwin_pid" 2>/dev/null || true; fi
}
trap cleanup EXIT INT TERM
socket_ready=0
for _ in $(seq 1 100); do
if [ -S "$XDG_RUNTIME_DIR/wayland-1" ]; then socket_ready=1; break; fi
kill -0 "$kwin_pid" 2>/dev/null || break
sleep 0.1
done
ready=0
if [ "$socket_ready" -eq 1 ] && timeout 5 env WAYLAND_DISPLAY=wayland-1 wayland-info >/dev/null 2>&1; then
ready=1
fi
if [ "$ready" -ne 1 ]; then
echo "== KDE nested Wayland compositor did not become ready"
exit 70
fi
echo "== launching Plasma Mobile on nested Wayland display wayland-1"
QT_QPA_PLATFORM=wayland WAYLAND_DISPLAY=wayland-1 QSG_INFO=1 \
plasmashell -p org.kde.plasma.mobileshell &
plasmashell_pid=$!
if [ -n "${BL_DEBUG_DIR:-}" ]; then
printf "%s\n" "$plasmashell_pid" >"$BL_DEBUG_DIR/plasma-shell.pid"
fi
wait "$plasmashell_pid"
' >>"$plasma_log" 2>&1
result=$?
restore_systemd_dbus_service
trap - EXIT
echo "== Plasma Mobile session exited (status $result)"
exit "$result"
@@ -108,8 +108,17 @@ if [ -z "${BL_INSIDE:-}" ]; then
wayland-info >/dev/null 2>&1 && break
sleep 0.1
done
# The desktop (DroidDeck's hosted package) is its own nested compositor, labwc, drawing straight
# into the app's: no gamescope in between.
# LXQt uses its nested compositor; Plasma Mobile starts a nested KWin session. The selected
# primary desktop comes through BL_DESKTOP_ENV, while the independent secondary-display process
# starts directly in plasma-mobile mode.
if [ "$mode" = lxqt ] && [ "${BL_DESKTOP_ENV:-lxqt}" = plasma-mobile ]; then
mode=plasma-mobile
fi
if [ "$mode" = plasma-mobile ]; then
step "starting KDE Plasma Mobile"
[ -x /usr/local/bin/droiddeck-plasma-mobile ] || { echo "== Plasma Mobile launcher is missing"; exit 66; }
exec /usr/local/bin/droiddeck-plasma-mobile
fi
if [ "$mode" = lxqt ]; then
step "starting the desktop"
[ -x /usr/local/bin/droiddeck-desktop ] || { echo "== the desktop package is not installed"; exit 66; }