From a8409723756a682211036163e1c495e116c0d10c Mon Sep 17 00:00:00 2001 From: syoul Date: Thu, 25 Dec 2025 16:38:49 +0100 Subject: [PATCH] Script helper pour notifications desktop avec libnotify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fonction utilitaire pour notifications système - Support différents niveaux: info, success, error, warning - Utilisé par md_to_print_gui.sh pour feedback utilisateur --- scripts/md_to_print_notify.sh | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 scripts/md_to_print_notify.sh 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 +