feat: add CLAUDE_NOTIFIER_DISABLE env var for per-session opt-out#64
Merged
Conversation
aa9e9a2 to
bc9c5b6
Compare
Hooks install globally and run for every Claude session on a machine. On a shared SSH host this means the host plays sounds for other users' sessions, with no way to opt out short of the machine-wide mute flag. Add a CLAUDE_NOTIFIER_DISABLE env var: when set in a shell (to any value other than empty/0/false), every hook exits silently — no sound, popup, or signal — for sessions in that shell only. Implemented as isDisabled() / Test-NotifierDisabled helpers gated at the top of all 12 JS + PowerShell hooks, mirroring the existing isMuted short-circuit. Default behavior is unchanged when the var is unset. Closes #63
bc9c5b6 to
2731a5d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Closes #63.
Hooks are installed globally and run for every Claude session on a machine. On a shared SSH host this means the host's hooks play sounds for other users' sessions, with no per-session way to opt out — the existing mute flag is machine-wide and persistent.
This adds an opt-in
CLAUDE_NOTIFIER_DISABLEenvironment variable. When set in a shell (to any value other than empty/0/false), every hook exits silently — no sound, popup, or signal — for sessions in that shell only. An SSH user addsexport CLAUDE_NOTIFIER_DISABLE=1to their session/rc and their sessions go quiet; other sessions and the machine-wide mute flag are unaffected.Env vars propagate from the shell →
claude→ hook child processes, so this is the natural per-session scope. This is the same mechanism the reporter prototyped by patching_lib.ps1directly — this PR makes it official and update-safe.How
isMutedshort-circuit:isDisabled()inhook/_lib/config.jsTest-NotifierDisabledinhook/_lib.ps1Backward compatibility
With the var unset,
isDisabled()returnsfalseand every hook runs byte-for-byte as before. The check is pure (reads one env var, no I/O). No extension/srcchange — the long-running extension can't see a per-session env var, and the SSH/terminal-fallback path is exactly where the problem lives.