Follow the desktop accent colour and colour scheme (XDG portal) (#3)
This commit was merged in pull request #3.
This commit is contained in:
1 parent
02b08cb471
commit
1746884744
16 files changed
+947
-12
No files matched your search
+36
-4
@@ -2,7 +2,8 @@
|
||||
# Headless smoke test: start a private PipeWire + WirePlumber (two null
|
||||
# sinks, a loopback virtual microphone, a playback and a capture stream),
|
||||
# run every moonmix-probe action and check its effect, then, if
|
||||
# gtk4-broadwayd is available, render GUI screenshots.
|
||||
# gtk4-broadwayd is available, render GUI screenshots: with the theme's
|
||||
# accent and, through a fake XDG Desktop Portal, with a system accent colour.
|
||||
#
|
||||
# Only this *test harness* uses pw-cat (to create a playing stream); moonmix
|
||||
# itself talks to PipeWire through libwireplumber.
|
||||
@@ -60,7 +61,7 @@ CONF
|
||||
|
||||
PIDS=""
|
||||
cleanup() { for p in $PIDS; do kill "$p" 2>/dev/null || true; done; [ -n "${KEEP:-}" ] || rm -rf "$XDG_RUNTIME_DIR"; }
|
||||
trap cleanup EXIT INT TERM
|
||||
trap cleanup EXIT INT TERM PIPE
|
||||
|
||||
pipewire >"$XDG_RUNTIME_DIR/pipewire.log" 2>&1 & PIDS="$PIDS $!"
|
||||
sleep 1
|
||||
@@ -156,8 +157,39 @@ if [ -n "$SHOTS" ] && [ -x "$GUI" ]; then
|
||||
if command -v gtk4-broadwayd >/dev/null; then
|
||||
gtk4-broadwayd :5 >/dev/null 2>&1 & PIDS="$PIDS $!"
|
||||
sleep 1
|
||||
MOONMIX_ICON_DIR="$ROOT/data/icons" GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 MOONMIX_SCREENSHOT="$SHOTS" \
|
||||
timeout 30 "$GUI" || fail=1
|
||||
gui() { MOONMIX_ICON_DIR="$ROOT/data/icons" GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 timeout 30 stdbuf -oL "$GUI"; }
|
||||
# Default look: no session bus, so no portal and the theme's own accent.
|
||||
DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/no-bus" MOONMIX_SCREENSHOT="$SHOTS" gui || fail=1
|
||||
# System accent: a fake org.freedesktop.portal.Settings on a private
|
||||
# session bus reports a green accent, then switches to orange while
|
||||
# moonmix runs (SettingChanged); it takes the shots once orange is applied.
|
||||
PY=""
|
||||
for p in python3 /usr/bin/python3; do
|
||||
if "$p" -c 'from gi.repository import Gio' 2>/dev/null; then PY=$p; break; fi
|
||||
done
|
||||
if [ -n "$PY" ] && command -v dbus-daemon >/dev/null; then
|
||||
echo "### system accent colour (fake portal) -> $SHOTS-accent-<tab>.png"
|
||||
dbus-daemon --session --nofork --address="unix:path=$XDG_RUNTIME_DIR/bus" \
|
||||
>/dev/null 2>&1 & PIDS="$PIDS $!"
|
||||
export DBUS_SESSION_BUS_ADDRESS="unix:path=$XDG_RUNTIME_DIR/bus"
|
||||
for _ in $(seq 1 40); do [ -S "$XDG_RUNTIME_DIR/bus" ] && break; sleep 0.25; done
|
||||
mkfifo "$LOGS/portal.in"
|
||||
"$PY" "$ROOT/tools/fake-portal.py" 0.2 0.82 0.48 0 <"$LOGS/portal.in" >"$LOGS/portal.log" 2>&1 & PIDS="$PIDS $!"
|
||||
exec 4>"$LOGS/portal.in"
|
||||
for _ in $(seq 1 40); do grep -q ready "$LOGS/portal.log" 2>/dev/null && break; sleep 0.25; done
|
||||
MOONMIX_SCREENSHOT="$SHOTS-accent" MOONMIX_SCREENSHOT_ACCENT="#ff7800" gui >"$LOGS/accent.log" 2>&1 & GUIPID=$!
|
||||
for _ in $(seq 1 40); do grep -q 'accent #33d17a' "$LOGS/accent.log" && break; sleep 0.25; done
|
||||
echo "1 0.471 0 0" >&4 || true
|
||||
wait "$GUIPID" || fail=1
|
||||
exec 4>&-
|
||||
cat "$LOGS/accent.log"
|
||||
if ! grep -q 'accent #33d17a, light' "$LOGS/accent.log" || ! grep -q 'accent #ff7800, light' "$LOGS/accent.log"; then
|
||||
echo "FAIL: accent colour not read from the portal or not updated live"
|
||||
cat "$LOGS/portal.log"; fail=1
|
||||
fi
|
||||
else
|
||||
echo "python3 with gi or dbus-daemon not found; skipping the accent colour screenshots"
|
||||
fi
|
||||
else
|
||||
echo "gtk4-broadwayd not found; skipping GUI"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user