feat(notify): add --icon flag for custom contentImage in notifications#13
Open
wozniakos10 wants to merge 1 commit into
Open
feat(notify): add --icon flag for custom contentImage in notifications#13wozniakos10 wants to merge 1 commit into
wozniakos10 wants to merge 1 commit into
Conversation
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>
Owner
|
Cool idea. I'll try to check this out soon. Has it been working well for you? |
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.
Summary
--icon <path>CLI argument to thenotifysubcommandcmd_notify→send_local_notification_if_needed→send_notificationand passed as-contentImagetoterminal-notifier--iconis omitted--helpoutputMotivation
On macOS 12+,
terminal-notifier -appIconis blocked by the OS for third-party apps.-contentImageis 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 notificationcc-notifier notify --icon /path/to/icon.png— notification shows image on the rightcc-notifier notify --icon /nonexistent.png— gracefully skips-contentImage, no crashcc-notifier --help— shows updated usage and examples🤖 Generated with Claude Code