Created
July 12, 2025 16:28
-
-
Save lukebelliveau/669930fdf1a2808718d19d9fd53cc564 to your computer and use it in GitHub Desktop.
claude code pushback hook
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
| #!/bin/bash | |
| # Claude Code Notification Hook Setup: | |
| # 1. Make executable: chmod +x claude_notify.sh | |
| # 2. Configure Claude Code hook: | |
| # - Run: claude /hooks | |
| # - Select "Notification" event | |
| # - Add command: /path/to/claude_notify.sh | |
| # 3. Optional: Set environment variables for custom credentials: | |
| # - export PUSHOVER_APP_TOKEN=your_app_token | |
| # - export PUSHOVER_USER_KEY=your_user_key | |
| # Pushover credentials (fallback to hardcoded if env vars not set) | |
| APP_TOKEN=YOUR_PUSHOVER_APP_TOKEN | |
| USER_KEY=YOUR_PUSHOVER_USER_KEY | |
| # Get hostname | |
| HOSTNAME="${HOSTNAME:-$(hostname)}" | |
| # Create message | |
| MESSAGE="Claude Code awaiting input on $HOSTNAME [$(date '+%H:%M:%S')]" | |
| # Send Pushover notification | |
| curl -s \ | |
| --form-string "token=$APP_TOKEN" \ | |
| --form-string "user=$USER_KEY" \ | |
| --form-string "title=Claude Code" \ | |
| --form-string "message=$MESSAGE" \ | |
| --form-string "url=termius://" \ | |
| https://api.pushover.net/1/messages.json > /dev/null | |
| # Fallback: desktop notification | |
| case "$(uname)" in | |
| Darwin) | |
| osascript -e "display notification \"$MESSAGE\" with title \"Claude Code\" sound name \"Glass\"" 2>/dev/null | |
| ;; | |
| Linux) | |
| notify-send "Claude Code" "$MESSAGE" 2>/dev/null | |
| ;; | |
| esac | |
| # Last resort: terminal bell | |
| echo -ne '\a' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment