Script helper pour notifications desktop avec libnotify

- Fonction utilitaire pour notifications système
- Support différents niveaux: info, success, error, warning
- Utilisé par md_to_print_gui.sh pour feedback utilisateur
This commit is contained in:
syoul
2025-12-25 16:38:49 +01:00
parent 5a67a0998c
commit a840972375

46
scripts/md_to_print_notify.sh Executable file
View File

@@ -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