docs/Desktop-Notifications.md
Fabric supports desktop notifications to alert you when commands complete, which is especially useful for long-running tasks or when you're multitasking.
Enable notifications with the --notification flag:
fabric --pattern summarize --notification < article.txt
--notification: Enable desktop notifications when command completes--notification-command: Use a custom notification command instead of built-in notificationsAdd notification settings to your ~/.config/fabric/config.yaml:
# Enable notifications by default
notification: true
# Optional: Custom notification command
notificationCommand: 'notify-send --urgency=normal "$1" "$2"'
Default: Uses osascript (built into macOS)
Enhanced: Install terminal-notifier for better notifications:
brew install terminal-notifier
Requirement: Install notify-send:
# Ubuntu/Debian
sudo apt install libnotify-bin
# Fedora
sudo dnf install libnotify
The --notification-command flag allows you to use custom notification scripts or commands. The command receives the title as $1 and message as $2 as shell positional arguments.
Security Note: The title and message content are properly escaped to prevent command injection attacks from AI-generated output containing shell metacharacters.
macOS with custom sound:
fabric --pattern analyze_claims --notification-command 'osascript -e "display notification \"$2\" with title \"$1\" sound name \"Ping\""' < document.txt
Linux with urgency levels:
fabric --pattern extract_wisdom --notification-command 'notify-send --urgency=critical "$1" "$2"' < video-transcript.txt
Custom script:
fabric --pattern summarize --notification-command '/path/to/my-notification-script.sh "$1" "$2"' < report.pdf
Testing your custom command:
# Test that $1 and $2 are passed correctly
fabric --pattern raw_query --notification-command 'echo "Title: $1, Message: $2"' "test input"
Notifications include:
For long outputs, the message is truncated with "..." to fit notification display limits.
# Process large document with notifications
fabric --pattern analyze_paper --notification < research-paper.pdf
# Extract wisdom from long video with alerts
fabric -y "https://youtube.com/watch?v=..." --pattern extract_wisdom --notification
# Process multiple files and get notified when each completes
for file in *.txt; do
fabric --pattern summarize --notification < "$file" &
done
# Combine with other commands
curl -s "https://api.example.com/data" | \
fabric --pattern analyze_data --notification --output results.md
Check system notifications are enabled for Terminal/your shell
Verify notification tools are installed:
which osascript (should exist)which notify-sendwhere.exe powershellTest with simple command:
echo "test" | fabric --pattern raw_query --notification --dry-run
On some systems, you may need to grant notification permissions to your terminal application:
Create different configuration files for different environments:
# Work computer (quieter notifications)
fabric --config ~/.config/fabric/work-config.yaml --notification
# Personal computer (with sound)
fabric --config ~/.config/fabric/personal-config.yaml --notification
# Custom script that also logs to task management system
notificationCommand: '/usr/local/bin/fabric-notify-and-log.sh "$1" "$2"'
See docs/notification-config.yaml for a complete configuration example with various notification command options.