Commit | Line | Data |
---|---|---|
43e49903 SK |
1 | BEGIN { |
2 | # Set the correct value as any other AWK variable: | |
3 | # | |
03c229bf | 4 | # khatus_actuate_alert_to_notify_send -v Display="$CORRECT_DISPLAY" |
43e49903 | 5 | # |
03c229bf | 6 | Display = Display ? Display : ":0" |
43e49903 SK |
7 | } |
8 | ||
75b23ff8 | 9 | $1 == "OK" && \ |
03c229bf SK |
10 | $2 == "alert" { |
11 | priority = $3 | |
12 | subject = $4 | |
75b23ff8 | 13 | |
03c229bf | 14 | # Not just using $5 for body - because body might contain a character |
75b23ff8 SK |
15 | # identical to FS |
16 | len_line = length($0) | |
17 | len_head = length($1 FS $2 FS $3 FS $4 FS $5 FS) | |
18 | len_body = len_line - len_head | |
19 | body = substr($0, len_head + 1, len_body) | |
43e49903 | 20 | |
43e49903 SK |
21 | urgency = priority |
22 | sub("hi" , "critical", urgency) | |
23 | sub("med", "normal" , urgency) | |
24 | ||
25 | cmd = \ | |
26 | sprintf(\ | |
27 | "DISPLAY=%s notify-send -u %s %s \" %s\"", | |
03c229bf | 28 | Display, urgency, subject, body \ |
43e49903 SK |
29 | ) |
30 | system(cmd) | |
31 | next | |
32 | } |