Add a more detailed --verify flow to capture Jack/ELD/subdevices, route per sink, and collect kernel error windows. Improve --fix with readiness gating, retries, and connected-only selection; document single-monitor pcm mapping behavior and ignore local logs/artifacts. Made-with: Cursor
28 lines
977 B
Bash
Executable File
28 lines
977 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# 登录后跑一次与 kaisa-audio-doctor --fix 相同的收敛,缓解「重启后 WirePlumber 恢复错误默认路由 /
|
|
# PipeWire 残留 error 节点」导致的必现无声。供 systemd --user 调用。
|
|
#
|
|
# 环境变量:
|
|
# KAISA_REPO 仓库根目录(未设置则从本脚本位置推断)
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="${KAISA_REPO:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
|
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/kaisa-audio"
|
|
LOG="${KAISA_BOOT_FIX_LOG:-${STATE_DIR}/last-boot-fix.log}"
|
|
mkdir -p "$(dirname "$LOG")"
|
|
|
|
if [[ "${EUID}" -eq 0 ]]; then
|
|
echo "kaisa-audio-boot-fix: refuse to run as root" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# 等 PipeWire/Pulse 套接字就绪(冷启动桌面可能较慢)
|
|
for _ in $(seq 1 45); do
|
|
if [[ -n "${XDG_RUNTIME_DIR:-}" && -S "${XDG_RUNTIME_DIR}/pulse/native" ]] && pactl info &>/dev/null; then
|
|
break
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
exec "${REPO_ROOT}/scripts/kaisa-audio-doctor.sh" --fix-only -o "$LOG"
|