Skip to content

feat(notify): add --icon flag for custom contentImage in notifications - #13

Merged
trentmcnitt merged 1 commit into
trentmcnitt:mainfrom
wozniakos10:main
May 29, 2026
Merged

feat(notify): add --icon flag for custom contentImage in notifications#13
trentmcnitt merged 1 commit into
trentmcnitt:mainfrom
wozniakos10:main

Conversation

@wozniakos10

Copy link
Copy Markdown
Contributor

Summary

  • Adds optional --icon <path> CLI argument to the notify subcommand
  • The path is forwarded through cmd_notifysend_local_notification_if_neededsend_notification and passed as -contentImage to terminal-notifier
  • No default value — behaviour is unchanged when --icon is omitted
  • Adds hook configuration examples (with and without icon) to --help output

Motivation

On macOS 12+, terminal-notifier -appIcon is blocked by the OS for third-party apps. -contentImage is the supported way to display a custom image in notifications. This change lets users configure a custom icon per-hook without modifying the source.

Example hook configuration

{
  "hooks": {
    "SessionStart": [{"matcher": "*", "hooks": [{"type": "command",
      "command": "$HOME/.cc-notifier/cc-notifier init"}]}],
    "Stop": [{"matcher": "*", "hooks": [{"type": "command",
      "command": "$HOME/.cc-notifier/cc-notifier notify --icon $HOME/.claude/hooks/my-icon.png"}]}],
    "Notification": [{"matcher": "permission_prompt|elicitation_dialog",
      "hooks": [{"type": "command",
      "command": "$HOME/.cc-notifier/cc-notifier notify --icon $HOME/.claude/hooks/my-icon.png"}]}],
    "SessionEnd": [{"matcher": "*", "hooks": [{"type": "command",
      "command": "$HOME/.cc-notifier/cc-notifier cleanup"}]}]
  }
}

Test plan

  • cc-notifier notify (no flag) — behaviour unchanged, no image in notification
  • cc-notifier notify --icon /path/to/icon.png — notification shows image on the right
  • cc-notifier notify --icon /nonexistent.png — gracefully skips -contentImage, no crash
  • cc-notifier --help — shows updated usage and examples

🤖 Generated with Claude Code

Pass an optional --icon <path> argument to the notify subcommand to
display a custom image (PNG) in macOS notifications via terminal-notifier
-contentImage. The path is forwarded through cmd_notify ->
send_local_notification_if_needed -> send_notification with no default
value, keeping the behaviour unchanged when the flag is omitted.

Adds hook configuration examples to the help text.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@trentmcnitt

Copy link
Copy Markdown
Owner

Cool idea. I'll try to check this out soon. Has it been working well for you?

@wozniakos10

Copy link
Copy Markdown
Contributor Author

Yes, it has been working well for me.

@trentmcnitt
trentmcnitt merged commit 855f6b0 into trentmcnitt:main May 29, 2026
1 check failed
@trentmcnitt

Copy link
Copy Markdown
Owner

Merged! Thanks, @wozniakos10

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.

2 participants