Skip to content

antic222/claude-code-ghostty-notifications

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configure Claude Code Completion Notifications in ghostty

English | 中文

Overview

This configuration demonstrates how to send desktop notifications through ghostty terminal when Claude Code tasks are completed. Claude Code supports a hooks mechanism that can execute custom commands when specific events occur.

Example screenshot: Claude Code notification in ghostty

Configuration Steps

1. Edit Configuration File

Open or create Claude Code's configuration file:

vim ~/.claude/settings.json

2. Add Stop Hook Configuration

Add the following content to the hooks section of the configuration file:

{
  "hooks": {
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "printf '\\e]9;Claude Code Task completed\\e\\\\' > /dev/tty"
          }
        ]
      }
    ]
  }
}

3. Save and Apply

After saving the file, the configuration will take effect automatically. No need to restart Claude Code.

Technical Details

Notification Mechanism

  • \e]9;...\e\\ is ghostty terminal's desktop notification escape sequence
  • This sequence sends a desktop notification to ghostty displaying the specified message
  • Clicking the notification will jump to the ghostty window
  • > /dev/tty redirects output to the current terminal device

Custom Notification Messages

You can customize the notification by modifying the message content:

"command": "printf '\\e]9;Your custom message\\e\\\\' > /dev/tty"

Trigger Timing

  • The Stop hook triggers when Claude Code task execution is completed
  • Triggers regardless of whether the task succeeds or fails

Verification Method

  1. Run a Claude Code task:

    claude "Help me list files in the current directory"
  2. After the task completes, ghostty will display a desktop notification: "Claude Code Task completed"

Complete Configuration Example

Check settings.example.json for the complete configuration file example.

Notes

  • This configuration only works with ghostty terminal
  • Other terminals may use different notification mechanisms
  • Ensure your ghostty version supports desktop notification functionality

License

This project uses the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors