Problem Statement
Claude Code's desktop notifications don't work when running inside tmux. This is because tmux requires applications to wrap OSC sequences in DCS passthrough format, but Claude Code sends plain OSC sequences.
Proposed Solution
Detect when running inside tmux (via $TMUX environment variable) and wrap notification sequences in DCS passthrough format:
# Plain (current):
printf '\033]9;message\007'
# DCS-wrapped for tmux:
printf '\033Ptmux;\033\033]9;message\007\033\\'
This is the standard pattern used by other terminal tools (imgcat, etc.).
Alternative Solutions
Users can create a notification hook as a workaround.
1. Create ~/.claude/hooks/tmux-notify.sh:
#!/bin/bash
# Only wrap for tmux - let Claude Code handle non-tmux natively
[ -z "$TMUX" ] && exit 0
read -r input
message=$(echo "$input" | jq -r '.message // "Claude Code"')
# Must output to /dev/tty - hook stdout is captured by Claude Code
printf '\033Ptmux;\033\033]9;%s\007\033\\' "$message" > /dev/tty
2. Add to ~/.claude/settings.json:
{
"hooks": {
"Notification": [
{
"hooks": [{ "type": "command", "command": "~/.claude/hooks/tmux-notify.sh" }]
}
]
}
}
This workaround requires manual setup and isn't discoverable by users.
Additional Context
Problem Statement
Claude Code's desktop notifications don't work when running inside tmux. This is because tmux requires applications to wrap OSC sequences in DCS passthrough format, but Claude Code sends plain OSC sequences.
Proposed Solution
Detect when running inside tmux (via
$TMUXenvironment variable) and wrap notification sequences in DCS passthrough format:This is the standard pattern used by other terminal tools (imgcat, etc.).
Alternative Solutions
Users can create a notification hook as a workaround.
1. Create
~/.claude/hooks/tmux-notify.sh:2. Add to
~/.claude/settings.json:{ "hooks": { "Notification": [ { "hooks": [{ "type": "command", "command": "~/.claude/hooks/tmux-notify.sh" }] } ] } }This workaround requires manual setup and isn't discoverable by users.
Additional Context
allow-passthrough on(orall)