Skip to content

Instantly share code, notes, and snippets.

@lukebelliveau
Created July 12, 2025 16:28
Show Gist options
  • Select an option

  • Save lukebelliveau/669930fdf1a2808718d19d9fd53cc564 to your computer and use it in GitHub Desktop.

Select an option

Save lukebelliveau/669930fdf1a2808718d19d9fd53cc564 to your computer and use it in GitHub Desktop.
claude code pushback hook
#!/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