Skip to content

Instantly share code, notes, and snippets.

@jankeesvw
Created January 14, 2026 12:57
Show Gist options
  • Select an option

  • Save jankeesvw/496b95ce59422dcfeb82f74a04ba6568 to your computer and use it in GitHub Desktop.

Select an option

Save jankeesvw/496b95ce59422dcfeb82f74a04ba6568 to your computer and use it in GitHub Desktop.
Claude Code waybar notification setup - shows when Claude needs attention

Claude Code Waybar Notification

Shows how many Claude Code sessions are waiting for input in your waybar.

How it works

  1. Hook triggers when Claude becomes idle β†’ adds πŸ”” to terminal title
  2. Waybar module counts windows with πŸ”” in title
  3. Click to focus that session

Files

~/.local/bin/claude-input-notify.sh

#!/bin/bash

case "$1" in
    set)
        # Add πŸ”” to current terminal title
        CURRENT_TITLE=$(hyprctl activewindow -j | jq -r '.title')
        if [[ "$CURRENT_TITLE" != *"πŸ””"* ]]; then
            printf '\033]2;πŸ”” %s\007' "$CURRENT_TITLE"
        fi
        ;;
    clear)
        # Remove πŸ”” from terminal title
        CURRENT_TITLE=$(hyprctl activewindow -j | jq -r '.title')
        NEW_TITLE="${CURRENT_TITLE//πŸ”” /}"
        printf '\033]2;%s\007' "$NEW_TITLE"
        ;;
    check)
        # Count windows with πŸ”” in title
        COUNT=$(hyprctl clients -j | jq -r '[.[] | select(.title | test("πŸ””"))] | length')

        if [ "$COUNT" -eq 0 ]; then
            echo '{"text":"󰚩","tooltip":"No Claude sessions waiting","class":"idle"}'
        elif [ "$COUNT" -eq 1 ]; then
            TITLE=$(hyprctl clients -j | jq -r '.[] | select(.title | test("πŸ””")) | .title' | head -1)
            echo "{\"text\":\"󰚩 $COUNT\",\"tooltip\":\"$TITLE\",\"class\":\"pending\"}"
        else
            TITLES=$(hyprctl clients -j | jq -r '.[] | select(.title | test("πŸ””")) | .title' | tr '\n' '\n')
            echo "{\"text\":\"󰚩 $COUNT\",\"tooltip\":\"$COUNT sessions waiting\",\"class\":\"pending\"}"
        fi
        ;;
    focus)
        # Focus Claude window (or show picker if multiple)
        WINDOWS=$(hyprctl clients -j | jq -r '.[] | select(.title | test("πŸ””|Claude")) | "\(.address)|\(.title)"')
        WINDOW_COUNT=$(echo "$WINDOWS" | grep -c . || echo 0)

        if [ "$WINDOW_COUNT" -eq 0 ]; then
            notify-send "Claude" "No Claude sessions found"
        elif [ "$WINDOW_COUNT" -eq 1 ]; then
            ADDR=$(echo "$WINDOWS" | head -1 | cut -d'|' -f1)
            hyprctl dispatch focuswindow "address:$ADDR"
        else
            # Multiple windows - use your preferred picker (wofi, rofi, walker, etc.)
            SELECTION=$(echo "$WINDOWS" | cut -d'|' -f2 | wofi --dmenu -p "Select Claude session")
            if [ -n "$SELECTION" ]; then
                ADDR=$(echo "$WINDOWS" | grep "|$SELECTION$" | cut -d'|' -f1)
                [ -n "$ADDR" ] && hyprctl dispatch focuswindow "address:$ADDR"
            fi
        fi
        ;;
esac

~/.claude/settings.json (hooks section)

{
  "hooks": {
    "Notification": [
      {
        "matcher": "idle_prompt",
        "hooks": [
          {
            "type": "command",
            "command": "~/.local/bin/claude-input-notify.sh set"
          }
        ]
      }
    ],
    "UserPromptSubmit": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "~/.local/bin/claude-input-notify.sh clear"
          }
        ]
      }
    ]
  }
}

Waybar config (add to config.jsonc)

{
  "modules-center": ["custom/claude"],
  
  "custom/claude": {
    "exec": "~/.local/bin/claude-input-notify.sh check",
    "return-type": "json",
    "interval": 5,
    "format": "{}",
    "on-click": "~/.local/bin/claude-input-notify.sh focus"
  }
}

Waybar style (optional, add to style.css)

#custom-claude.pending {
    color: #f9e2af;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

Requirements

  • Hyprland (uses hyprctl)
  • jq
  • waybar
  • A dmenu-compatible launcher (wofi, rofi, walker) for the picker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment