Build and install the native front-end on musicdolphin
slint-frontend/ in the app repo is a native front-end for the same backend, written because the React UI is sluggish on this device. This installs it beside the web UI, never instead of it: the systemd unit is installed but not enabled, so the device still boots into the kiosk browser and the two can be compared on the same screen. systemctl start musikdelfin # takes over the display systemctl stop musikdelfin # back to the browser underneath Unlike pi_musicmouse, which builds the web front-end on the control machine and rsyncs dist/, this builds on the device. A Rust binary is not portable, and the reason it has to be built here rather than cross-compiled is worth writing down: these Pis run 32-bit armhf Raspbian on a 64-bit kernel. `uname -m` says aarch64 and it is misleading; `dpkg --print-architecture` says armhf and that is the one that matters. Cross-compiling to armv7-unknown-linux-gnueabihf needs a sysroot, the devices carry no -dev packages to build one from, and reconstructing one from the Debian archive means owning a glibc skew risk indefinitely. Spending the device's own CPU once is the smaller liability. The build is stamped with the commit it came from, so it only runs again when that changes. The same fact rules out the Skia renderer that the app's own kiosk profile prefers: rust-skia publishes no prebuilt binaries for armhf. This builds --features desktop - winit, FemtoVG and the software renderer - and runs as an X client in the existing session. Worth noting after the fact: the FemtoVG bug that makes Skia the upstream recommendation (slint-ui/slint#11785, album covers drawn as solid black) was reported on a Pi 5 with a 64-bit userland and does not reproduce here - covers render correctly. Three things had to be found by running it rather than reading anything: The X session belongs to `kiosk`, not root, so the launcher needs that user's cookie and the unit runs as them. Without it winit fails with "could not initialize backend", which says nothing about authorization. winit and glutin dlopen every windowing and GL library they use, so none of them appear in `ldd` and the binary links happily without them - then aborts on first run with "Library libxkbcommon-x11.so could not be loaded". The runtime packages are listed explicitly for that reason. Raspbian ships no font containing the emoji the design uses as iconography, so the shelf badges rendered as empty boxes until fonts-noto-color-emoji went in. First build took 63 minutes: 570 crates, two jobs, nice'd, which bounds peak memory on musicdolphin's 1.8 GB. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
40
roles/pi_slint_frontend/templates/musikdelfin.sh.j2
Normal file
40
roles/pi_slint_frontend/templates/musikdelfin.sh.j2
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# {{ ansible_managed }}
|
||||
#
|
||||
# Run the native front-end on the kiosk's X display. The web UI stays where it is;
|
||||
# both talk to the same backend, so they can be compared on the same screen.
|
||||
#
|
||||
# musikdelfin the display, as the kiosk uses it
|
||||
# SLINT_BACKEND=winit-software musikdelfin no GPU, for comparison
|
||||
# SLINT_FULLSCREEN=0 musikdelfin a normal window, beside the browser
|
||||
# SLINT_DEBUG_PERFORMANCE=overlay,refresh_lazy musikdelfin frame timings on screen
|
||||
set -eu
|
||||
|
||||
# The kiosk's X session belongs to {{ pi_slint_frontend_x_user }}, and its cookie is
|
||||
# the only way onto that display - without it the connection is refused before winit
|
||||
# gets far enough to report anything more useful than "could not initialize backend".
|
||||
export DISPLAY="${DISPLAY:-:0}"
|
||||
export XAUTHORITY="${XAUTHORITY:-{{ pi_slint_frontend_x_home }}/.Xauthority}"
|
||||
|
||||
# Nunito is the face the design is drawn in; without it Slint falls back to whatever
|
||||
# fontconfig hands back, which changes how this looks but not whether it runs.
|
||||
for candidate in \
|
||||
/usr/share/fonts/truetype/nunito/Nunito[wght].ttf \
|
||||
/usr/share/fonts/truetype/nunito/Nunito-Regular.ttf \
|
||||
{{ pi_slint_frontend_root }}/fonts/Nunito.ttf
|
||||
do
|
||||
if [ -f "$candidate" ]; then
|
||||
export SLINT_DEFAULT_FONT="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
{% if pi_slint_frontend_fullscreen %}
|
||||
export SLINT_FULLSCREEN="${SLINT_FULLSCREEN:-1}"
|
||||
{% endif %}
|
||||
{% if pi_slint_frontend_debug_performance %}
|
||||
export SLINT_DEBUG_PERFORMANCE="${SLINT_DEBUG_PERFORMANCE:-{{ pi_slint_frontend_debug_performance }}}"
|
||||
{% endif %}
|
||||
|
||||
exec {{ pi_slint_frontend_root }}/target/release/musicmouse-slint \
|
||||
--server {{ pi_slint_frontend_server }} "$@"
|
||||
Reference in New Issue
Block a user