Working with Claude Code in the terminal can sometimes lead to missed input notifications,
especially when
you’re multitasking or have multiple windows open. That’s why I created claude-input-notify.sh
- a
simple but effective shell script that creates visual notifications whenever Claude Code needs your
attention.
The Problem
When using Claude Code, there are moments when it pauses and waits for user input - asking for confirmation, additional information, or next steps. If you’re working in another window or focused on a different task, you might miss these notifications, leaving Claude waiting indefinitely and disrupting your workflow.
The Solution
The claude-input-notify.sh
script uses Claude Code’s hooks system and automatically displays a
visual notification popup whenever Claude Code needs user input. This ensures
you never miss an important interaction point.
Key Features
Smart Terminal Detection
The script uses multiple methods to find your active terminal window:
- Searches for windows by process name (gnome-terminal, konsole, xterm, etc.)
- Falls back to the most recently focused window if needed
- Supports various terminal emulators
Visual Notification System
- Displays a clean, modern dialog with the Claude Code logo
- Shows clear messaging about what’s happening
- Provides an “OK” button to quickly return to the terminal
- Optional “Cancel” button for dismissing without action
- Can also be dismissed with the ESC key (same as Cancel)
- Displays custom messages from Claude Code when available
Developer-Friendly Options
- Debug mode (
DEBUG_MODE=1
environment variable): Shows detailed information about window detection - Test mode (
TEST_MODE=1
environment variable): Triggers a test notification to verify setup - Verbose output: Helps troubleshoot any issues
Installation and Setup
- First, ensure you have the required dependencies:
sudo apt install xdotool wmctrl yad jq
- Download the script and logo from my: own-debian-configs repository:
# Download the notification script
wget https://raw.githubusercontent.com/idachev/own-debian-configs/master/claude-input-notify.sh -O ~/bin/claude-input-notify.sh
chmod +x ~/bin/claude-input-notify.sh
# Download the Claude logo (optional, but recommended for better visuals)
wget https://raw.githubusercontent.com/idachev/own-debian-configs/master/claude-logo.png -O ~/bin/claude-logo.png
- Configure Claude to use the notification script automatically by editing
~/.claude/settings.json
:
{
"hooks": {
"Notification": [
{
"hooks": [
{
"type": "command",
"command": "~/bin/claude-input-notify.sh"
}
]
}
]
}
}
This hooks configuration ensures that the notification script runs automatically whenever Claude Code needs user input - no manual piping required!
How It Works
When configured as a Claude hook, the script is automatically triggered whenever Claude Code needs user input. The process flow is:
- Claude Code detects it needs user input and triggers the Notification hook
- The script reads any JSON message from stdin to display custom notifications
- Identifies the terminal window where Claude Code is running
- Creates a notification dialog using
yad
(Yet Another Dialog) - When you click “OK”, it automatically brings the terminal window to focus
- ESC or Cancel simply dismisses the notification without switching focus
- Returns you right where you need to be to continue your interaction
Advanced Usage
Debug Mode
To debug window detection issues, run the script manually with the debug environment variable:
DEBUG_MODE=1 ~/bin/claude-input-notify.sh
Test the Notification
To verify everything is working:
TEST_MODE=1 ~/bin/claude-input-notify.sh
Technical Implementation
The script leverages several Linux utilities:
- xdotool: For window manipulation and focus management
- wmctrl: As a fallback for window operations
- yad: For creating the GTK+ dialog
- pgrep/ps: For process detection
- jq: Optional JSON parser for extracting custom messages from Claude Code hooks
The script reads JSON data from stdin when triggered by Claude Code hooks, allowing it to extract
and display custom messages. If jq
is not available, it falls back to basic regex extraction.
The notification can use either an external Claude logo file (claude-logo.png
) if available, or
falls back to an embedded base64-encoded logo. This makes the script flexible - it works out of the
box but looks even better with the custom logo file.
Benefits
- Never miss notifications: Stay aware of when Claude needs your input
- Improved workflow: Seamlessly switch between tasks without losing track
- Visual feedback: Clear, impossible-to-miss notifications
- Easy integration: Works with any terminal setup
- Lightweight: Minimal resource usage, runs only when needed
Where to Get It
The complete solution including the script and logo file is available in my GitHub repository:
- GitHub: own-debian-configs
- Script: claude-input-notify.sh
- Logo: claude-logo.png
Conclusion
This simple utility has significantly improved my workflow when working with Claude Code. By leveraging Claude’s built-in hooks system, it integrates seamlessly without requiring any complex setup or background processes. It’s one of those small tools that solves a specific problem elegantly.
If you’re a frequent Claude Code user working in the terminal, give claude-input-notify.sh
a try.
Combined with Claude’s hooks configuration, it provides a frictionless way to stay engaged with your
AI assistant, ensuring you never leave Claude waiting for your input again!