aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/status/notify-sound
blob: c028b3ee2c3b094667c83fe1c80e504b54dbdbc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
#
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# The one place Claude and opencode play their sounds, so quiet mode can
# silence both. Their popups do not come through here and are unaffected.
#
#   notify-sound claude                         Claude Code's Notification hook
#   notify-sound <opencode-notifier event>      the notifier's command hook
#
# An argument with no sound plays nothing. That is deliberate: the opencode
# notifier runs its command for every event, session_started and
# user_message included, and only four of them ever made a sound.

set -u

here="$(dirname "$(readlink -f "$0")")"
[[ "$("$here/statusctl" quiet get)" == "1" ]] && exit 0

dir="${NOTIFY_SOUND_DIR:-$HOME/Music/notify}"

case "${1:-}" in
    claude)                  file="claude-attention.opus" ;;
    permission)              file="opencode-perms.opus" ;;
    complete|error|question) file="opencode-attention.opus" ;;
    *)                       exit 0 ;;
esac

exec paplay "$dir/$file" 2>/dev/null