Files
DroidDeck/tools/linuxfs/desktop/steamdeck-desktop
T
The412Banner 6c380528f3 Desktop: give fontconfig its default rules
/etc/fonts/conf.d in the rootfs holds only the README: none of fontconfig's
rules that map sans-serif, serif and monospace onto installed faces. Programs
find the fonts and no default font; Firefox logs 'no fonts' and draws pages
without text. The desktop launcher links the 33 default rules in when the
directory has none.
2026-09-20 05:00:24 -04:00

55 lines
3.7 KiB
Bash

#!/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.
# The nested output takes the app's surface size; left alone, wlroots' Wayland backend opens
# a 1280x720 window and the whole desktop is upscaled from that.
sed "s/@MODE@/${BL_WIDTH:-1280}x${BL_HEIGHT:-720}/" /etc/xdg/labwc/rc.xml > "$HOME/.config/labwc/rc.xml"
cp -f /etc/xdg/labwc/autostart "$HOME/.config/labwc/autostart"
# panel.conf is the user's once the panel has written it, except the one our first package
# shipped: it never named its panel ([General] panels=), so lxqt-panel built an empty default
# one. That file is replaced; one that names its panels is kept.
if ! grep -q '^panels=' "$HOME/.config/lxqt/panel.conf" 2>/dev/null; then
cp -f /etc/xdg/lxqt/panel.conf "$HOME/.config/lxqt/panel.conf"
fi
[ -f "$HOME/.config/lxqt/lxqt.conf" ] || cp /etc/xdg/lxqt/lxqt.conf "$HOME/.config/lxqt/lxqt.conf"
# pcmanfm-qt paints the desktop; left unconfigured it paints it black, over swaybg's wallpaper.
if [ ! -f "$HOME/.config/pcmanfm-qt/lxqt/settings.conf" ]; then
mkdir -p "$HOME/.config/pcmanfm-qt/lxqt"
printf '[Desktop]\nWallpaper=/usr/share/backgrounds/steamdeck.png\nWallpaperMode=zoom\nBgColor=#1b1030\nShowHidden=false\n' \
> "$HOME/.config/pcmanfm-qt/lxqt/settings.conf"
fi
# 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
# fontconfig's rules (sans-serif -> DejaVu Sans and the rest) live as links in /etc/fonts/conf.d,
# and the rootfs has none: applications then find fonts but no default font. Firefox logs
# "no fonts" and draws pages without text.
if [ -d /usr/share/fontconfig/conf.default ] && ! ls /etc/fonts/conf.d/*.conf >/dev/null 2>&1; then
for f in /usr/share/fontconfig/conf.default/*.conf; do ln -sf "$f" /etc/fonts/conf.d/; done
echo "== fontconfig: linked $(ls /etc/fonts/conf.d/*.conf | wc -l) default rules"
fi
echo "== steamdeck-desktop: labwc ($WLR_RENDERER) on $WAYLAND_DISPLAY"
# ~/.steamdeck-desktop-debug: labwc's own debug log (views and layer surfaces mapping) too.
DEBUG=; [ -f "$HOME/.steamdeck-desktop-debug" ] && DEBUG=-d
# 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 $DEBUG -C "$HOME/.config/labwc"
fi
exec labwc $DEBUG -C "$HOME/.config/labwc"