Skip to content

feat: add CLAUDE_NOTIFIER_DISABLE env var for per-session opt-out#64

Merged
ashmitb95 merged 1 commit into
mainfrom
feat/notifier-disable-env-var
Jun 21, 2026
Merged

feat: add CLAUDE_NOTIFIER_DISABLE env var for per-session opt-out#64
ashmitb95 merged 1 commit into
mainfrom
feat/notifier-disable-env-var

Conversation

@ashmitb95

@ashmitb95 ashmitb95 commented Jun 21, 2026

Copy link
Copy Markdown
Owner

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_DISABLE environment 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 adds export CLAUDE_NOTIFIER_DISABLE=1 to 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.ps1 directly — this PR makes it official and update-safe.

How

  • New helpers mirroring the existing isMuted short-circuit:
    • isDisabled() in hook/_lib/config.js
    • Test-NotifierDisabled in hook/_lib.ps1
  • Gated as the first statement in all 12 hooks (6 JS + 6 PowerShell), so a disabled session exits before any signal write or playback.

Backward compatibility

With the var unset, isDisabled() returns false and every hook runs byte-for-byte as before. The check is pure (reads one env var, no I/O). No extension/src change — the long-running extension can't see a per-session env var, and the SSH/terminal-fallback path is exactly where the problem lives.

@ashmitb95 ashmitb95 force-pushed the feat/notifier-disable-env-var branch from aa9e9a2 to bc9c5b6 Compare June 21, 2026 06:19
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
@ashmitb95 ashmitb95 force-pushed the feat/notifier-disable-env-var branch from bc9c5b6 to 2731a5d Compare June 21, 2026 06:21
@ashmitb95 ashmitb95 merged commit f483535 into main Jun 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Global hooks notify host for other users' SSH sessions

1 participant