blob: 85b486602366e8f4205105fdd98ba4d50c5f67a0 (
plain)
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
|
#!/bin/bash
set -Eeuo pipefail
test -f ~/.irssi/activity_file || exit 1
DIRECT_ONLY=""
while getopts D opt; do
case $opt in
D) DIRECT_ONLY="1" ;;
esac
done
has_activity() {
awk -v s=$1 -F, \
'BEGIN { c=1 } { if ($2 == s) c=0 } END { exit c }' \
~/.irssi/activity_file
}
print() {
printf "#[fg=green][#[fg=%s]M#[fg=green]]" "$1"
exit 0
}
if has_activity 3; then
print "red"
fi
if [[ -z "$DIRECT_ONLY" ]] && has_activity 2; then
print "white"
fi
|