diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7116775464..a1655338a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,7 +67,7 @@ jobs: uses: actions/cache@v4 with: path: app/src/main/assets/linuxfs - key: preloads-${{ env.PRELOAD_CACHE_VERSION }}-${{ hashFiles('app/src/main/cpp/fakeinput_steam.cpp', 'tools/linuxfs/preload/*.c', 'tools/linuxfs/overlay/usr/local/bin/*') }} + key: preloads-${{ env.PRELOAD_CACHE_VERSION }}-${{ hashFiles('app/src/main/cpp/fakeinput_steam.cpp', 'tools/linuxfs/preload/*.c', 'tools/linuxfs/overlay/usr/local/bin/*', 'tools/linuxfs/desktop/*') }} - name: Build libfakeinput.so and libblsession.so (glibc aarch64) if: steps.preloads.outputs.cache-hit != 'true' @@ -91,6 +91,10 @@ jobs: for script in tools/linuxfs/overlay/usr/local/bin/bannerlator-*; do install -Dm644 "$script" "$D/usr/local/bin/$(basename "$script")" done + # And the desktop's launcher and labwc defaults, staged over the desktop package's copies. + install -Dm644 tools/linuxfs/desktop/steamdeck-desktop "$D/usr/local/bin/steamdeck-desktop" + install -Dm644 tools/linuxfs/desktop/autostart "$D/etc/xdg/labwc/autostart" + install -Dm644 tools/linuxfs/desktop/rc.xml "$D/etc/xdg/labwc/rc.xml" ls -lR "$D" # Runs whether the preloads were built or restored: readelf reads any ELF whatever the host, diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionFiles.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionFiles.kt index ebcb2862f0..7979cdab07 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionFiles.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionFiles.kt @@ -32,7 +32,15 @@ object SessionFiles { "usr/local/bin/bannerlator-seed-redists" to "usr/local/bin/bannerlator-seed-redists", "usr/local/bin/bannerlator-proton-extra" to "usr/local/bin/bannerlator-proton-extra", ) - for ((asset, relative) in files) { + // The desktop's launcher and labwc defaults, only where the desktop package is installed: + // staging them into a runtime without it would make the desktop look present when it is not. + val desktop = arrayOf( + "usr/local/bin/steamdeck-desktop" to "usr/local/bin/steamdeck-desktop", + "etc/xdg/labwc/autostart" to "etc/xdg/labwc/autostart", + "etc/xdg/labwc/rc.xml" to "etc/xdg/labwc/rc.xml", + ) + val all = if (File(root, "usr/bin/labwc").isFile) files + desktop else files + for ((asset, relative) in all) { val target = File(root, relative) val staged = File(target.parentFile, target.name + ".staged") var installed = false diff --git a/tools/linuxfs/desktop/autostart b/tools/linuxfs/desktop/autostart new file mode 100644 index 0000000000..b590d04361 --- /dev/null +++ b/tools/linuxfs/desktop/autostart @@ -0,0 +1,6 @@ +# What the desktop is made of, started once labwc is up. Everything logs into the session log. +swaybg -m fill -i /usr/share/backgrounds/steamdeck.png & +# Desktop icons (pcmanfm-qt manages the desktop surface) and the panel with the app menu. +pcmanfm-qt --desktop --profile lxqt 2>&1 | sed 's/^/[pcmanfm-qt] /' & +lxqt-panel 2>&1 | sed 's/^/[lxqt-panel] /' & +/usr/lib/xdg-desktop-portal-wlr >/dev/null 2>&1 & diff --git a/tools/linuxfs/desktop/rc.xml b/tools/linuxfs/desktop/rc.xml new file mode 100644 index 0000000000..6b3916ede6 --- /dev/null +++ b/tools/linuxfs/desktop/rc.xml @@ -0,0 +1,21 @@ + + + + 0yes + + Clearlooks + 6 + DejaVu Sans11 + + center + + + + + qterminal + pcmanfm-qt + + + 500 + diff --git a/tools/linuxfs/desktop/steamdeck-desktop b/tools/linuxfs/desktop/steamdeck-desktop new file mode 100644 index 0000000000..249194fbe8 --- /dev/null +++ b/tools/linuxfs/desktop/steamdeck-desktop @@ -0,0 +1,32 @@ +#!/bin/bash +# The desktop session: labwc nested as a client of the app's compositor, with LXQt's panel and +# file manager started from its autostart, and Xwayland for the X11 programs (the Steam client, +# most emulators). Run by bannerlator-session in place of gamescope for mode "lxqt". +# Staged by the app over the desktop package's copy on every launch, so a fix here reaches an +# installed desktop without re-downloading the package. +set -u +export XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=LXQt XDG_SESSION_DESKTOP=lxqt +export QT_QPA_PLATFORM=wayland GDK_BACKEND=wayland,x11 SDL_VIDEODRIVER=wayland,x11 +export QT_QPA_PLATFORMTHEME=lxqt +# wlroots allocates through gbm on a real DRM node, which the KGSL stand-in is not: pixman +# (software, shm) is what boots here. BL_WLR_RENDERER=vulkan/gles2 tries acceleration. +export WLR_RENDERER=${BL_WLR_RENDERER:-pixman} +export WLR_BACKENDS=wayland +mkdir -p "$HOME/.config/labwc" "$HOME/.config/lxqt" +# Our defaults for labwc and the panel, refreshed every session. What a user changes in the +# panel's own settings lands in panel.conf and is kept; only rc.xml and autostart are ours. +cp -f /etc/xdg/labwc/rc.xml "$HOME/.config/labwc/rc.xml" +cp -f /etc/xdg/labwc/autostart "$HOME/.config/labwc/autostart" +[ -f "$HOME/.config/lxqt/panel.conf" ] || cp /etc/xdg/lxqt/panel.conf "$HOME/.config/lxqt/panel.conf" +[ -f "$HOME/.config/lxqt/lxqt.conf" ] || cp /etc/xdg/lxqt/lxqt.conf "$HOME/.config/lxqt/lxqt.conf" +# The runtime directory outlives a session. lxqt-panel and pcmanfm-qt are single-instance +# programs that leave a lock and a socket there; finding last session's, they decide they are +# already running and exit without a word - a desktop with a wallpaper and nothing on it. +# Only the app's own compositor socket (wayland-0) is kept. +find "$XDG_RUNTIME_DIR" -mindepth 1 -maxdepth 1 ! -name 'wayland-0*' ! -name 'keymap.xkb' -exec rm -rf {} + 2>/dev/null +echo "== steamdeck-desktop: labwc ($WLR_RENDERER) on $WAYLAND_DISPLAY" +# A session bus: the panel's menus, the file manager and the portal all expect one. +if command -v dbus-run-session >/dev/null 2>&1; then + exec dbus-run-session -- labwc -C "$HOME/.config/labwc" +fi +exec labwc -C "$HOME/.config/labwc"