Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
1234567891011121314151617181920212223242526#!/bin/bash# Slab-scoped afplay wrapper. Records the inner afplay PID in# /tmp/slab-afplay/<pid> for the lifetime of the playback so a fade /# mute / Stop hook can silence ONLY the sounds slab spawned, not every# afplay on the system (`pkill -x afplay` historically killed user music).## Drop-in replacement for /usr/bin/afplay: same arg conventions, same# blocking semantics. Background it with `&` if you don't want to wait.set -uSOUND="${1:-}"[[ -z "$SOUND" ]] && exit 0REG_DIR=/tmp/slab-afplaymkdir -p "$REG_DIR" 2>/dev/null/usr/bin/afplay "$SOUND" 2>/dev/null &afpid=$!marker="$REG_DIR/$afpid": > "$marker" 2>/dev/nullcleanup() { rm -f "$marker" 2>/dev/null; }trap cleanup EXIT TERM INTwait "$afpid" 2>/dev/nullexit 0