A Claude Code Stop hook that plays a sound every time a turn finishes, but stays silent when the window hosting the session is focused. So you only hear it when you've tabbed away.
It works whether Claude Code runs in Terminal, iTerm2, Ghostty, or an editor's integrated terminal (Zed, VS Code), because the focus check walks the process tree rather than matching app names.
Claude Code's built-in terminal bell only fires when it needs your attention (a permission prompt or waiting on input), not on plain quick completions. If you want an audible "done" on every turn, a
Stop hook with afplay is reliable and independent of your terminal's bell settings.