Bring back src module name in messages
[khatus.git] / src / awk / exe / actuate_alert_to_notify_send.awk
1 BEGIN {
2 # Set the correct value as any other AWK variable:
3 #
4 # khatus_actuate_alert_to_notify_send -v Display="$CORRECT_DISPLAY"
5 #
6 Display = Display ? Display : ":0"
7 }
8
9 $1 == "OK" && \
10 $3 == "alert" {
11 src = $2
12 priority = $4
13 subject = $5
14
15 # Not just using $6 for body - because body might contain a character
16 # identical to FS
17 len_line = length($0)
18 len_head = length($1 FS $2 FS $3 FS $4 FS $5 FS)
19 len_body = len_line - len_head
20 body = substr($0, len_head + 1, len_body)
21
22 sep = body ? "\n" : ""
23 body = body sep "--" src
24 urgency = priority
25 sub("hi" , "critical", urgency)
26 sub("med", "normal" , urgency)
27
28 cmd = \
29 sprintf(\
30 "DISPLAY=%s notify-send -u %s %s \" %s\"",
31 Display, urgency, subject, body \
32 )
33 system(cmd)
34 next
35 }
This page took 0.045856 seconds and 4 git commands to generate.