diff --git a/scripts/md_to_print_notify.sh b/scripts/md_to_print_notify.sh new file mode 100755 index 0000000..8ea2039 --- /dev/null +++ b/scripts/md_to_print_notify.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Script utilitaire pour les notifications MD_to_Print +# Usage: md_to_print_notify.sh [level] [message] + +set -euo pipefail + +LEVEL="${1:-info}" +MESSAGE="${2:-}" +ICON="" +URGENCY="normal" + +case "$LEVEL" in + info|INFO) + ICON="dialog-information" + URGENCY="low" + ;; + success|SUCCESS) + ICON="dialog-information" + URGENCY="normal" + ;; + warning|WARN) + ICON="dialog-warning" + URGENCY="normal" + ;; + error|ERROR) + ICON="dialog-error" + URGENCY="critical" + ;; + *) + ICON="dialog-information" + URGENCY="normal" + ;; +esac + +if [ -z "$MESSAGE" ]; then + echo "Usage: $0 [level] [message]" + exit 1 +fi + +if command -v notify-send &> /dev/null; then + notify-send -u "$URGENCY" -i "$ICON" "MD_to_Print" "$MESSAGE" 2>/dev/null || true +else + echo "[$LEVEL] $MESSAGE" >&2 +fi +