Menu

[r42]: / plugins / ivmnotify.sh  Maximize  Restore  History

Download this file

44 lines (35 with data), 1.3 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
. /etc/default/locale
export LC_ALL="$LANG"
if [ $# -ne 6 ] || [ -z "$5" ] || [ -z "$6" ]
then
echo "Usage: $0 [notty,nox] [urgency] [time] [icon] title text"
exit 0
fi
. /usr/share/ivman-plugins/common.sh
checkvt
mode="$1"
urgency="$2"
time="$3"
icon="$4"
export title="$5"
export text="$6"
# Est-ce qu'il s'agit d'un serveur X avec session ouverte et qu'on n'a pas interdit l'affichage X
if [ -n "$vt_x" ] && [ -n "$vt_user" ] && [ -z "$(echo "$mode" | grep "nox")" ]
then
[ -n "$NOTIFY_SEND" ] && { DISPLAY=:$display $NOTIFY_SEND -u "$urgency" -t "$time" -i "$icon" "$title" "$text"; exit 0; }
[ -n "$ZENITY" ] && { DISPLAY=:$display $ZENITY --title "$title" --window-icon "$icon" --timeout $(expr $time / 1000) --info --text "$text"; exit 0; }
[ -n "$GTKDIALOG" ] && { DISPLAY=:$display $GTKDIALOG -c -f /usr/share/ivman-plugins/ivmnotify.gtkdialog; exit 0; }
# S'il s'agit d'une console système ou d'une session X sans utilisateur et qu'on n'a pas interdit l'affichage TTY
elif [ -z "$(echo "$mode" | grep "notty")" ]
then
if [ -n "$DIALOG" ]
then
openvt -s sh -c "$DIALOG --clear --title \"$title\" --infobox \"$text\" 20 60"
sleep $(expr $time / 1000)
chvt $vt
deallocvt
exit 0
fi
fi
exit 0