#!/bin/sh
if [ -z "$XDG_RUNTIME_DIR" ]; then
export XDG_RUNTIME_DIR="/var/run/user/$(id -u)"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 700 "$XDG_RUNTIME_DIR"
fi
pgrep -U "$(id -u)" -x pulseaudio >/dev/null && killall pulseaudio
sleep 5
pgrep -U "$(id -u)" -x pipewire >/dev/null || pipewire &
sleep 1
pgrep -U "$(id -u)" -x wireplumber >/dev/null || wireplumber &
pgrep -U "$(id -u)" -x pipewire-pulse >/dev/null || pipewire-pulse &