feat(omo): play omo's own synthesised notification sounds

omo-notify and omo-remote played Apple's Glass and Ping through afplay, which exist only on macOS and are not ours to ship. They now play omo-done (task finished), omo-input (needs your input) and omo-error (stopped with an error), rendered by sfx from .config/omo/sounds/recipes.toml at the same loudness as Glass. The new omo-sound plays a sound by name or any audio file, with afplay on macOS and pw-play, paplay, aplay or ffplay on Linux, and finds the sounds through the dotfiles checkout it is linked from.
This commit is contained in:
David Ibia
2026-10-18 12:56:09 +01:00
parent 5805f45358
commit 66d1d21011
8 changed files with 66 additions and 11 deletions
+4 -4
View File
@@ -124,9 +124,9 @@ case ${1:-} in
[[ $tags == *,omo,* ]] || exit 0 # Claude Code posts to the same topic
(($(date +%s) - ${NTFY_TIME:-0} <= fresh)) || exit 0
case $tags in
*,question,*) state=input sound=Ping ;;
*,x,*) state=error sound=Glass ;;
*) state="done" sound=Glass ;;
*,question,*) state=input sound=omo-input ;;
*,x,*) state=error sound=omo-error ;;
*) state="done" sound=omo-done ;;
esac
# "attached" only says some terminal shows the session: a tmux pane here
# (the title path has it), a plain tab, or a mosh-server left behind.
@@ -135,7 +135,7 @@ case ${1:-} in
logline "ntfy $state ${NTFY_TITLE:-} skipped: a tmux pane got it through the title"
exit 0
fi
afplay "/System/Library/Sounds/${sound}.aiff" >/dev/null 2>&1 &
"$HOME/.local/bin/omo-sound" "$sound" >/dev/null 2>&1 &
# Ghostty posts the banner from a plain tab connected with mosh or ssh, so
# clicking it lands there, or else from the tmux tab you used last.
target=$(plain_tab_tty "$tags")