Source

pcw / extras / pcw_notify.sh

#!/bin/bash
FILE="$HOME/.pcw_notify"
CHAN="$1"
NICK="$2"

[ -f "$FILE" ] || printf "\n\n\n\n\n\n\n\n\n\n\n" > "$FILE" || exit 2

if ! pgrep -lf pcw_notify_dzen > /dev/null 2>&1; then
	while true; do
		{ tail "$FILE"; tail -n 1 "$FILE"; } | tac
		sleep 1
	done | dzen2 -m -e 'entertitle=uncollapse,grabkeys;enterslave=grabkeys;leaveslave=collapse,ungrabkeys;button1=menuprint;button2=togglestick;button3=exit:13;button4=scrollup;button5=scrolldown;key_Escape=ungrabkeys,exit' -x 1000 -w 920 -l 10 -u -h 14 -title-name "pcw_notify_dzen" -fg '#b20033' -bg black -fn "monospace-10" | while read line; do
		path="$(echo "$line" | cut -d '|' -f 1 | sed "s/ *$//")"
		channel="$(basename "$path")"
		urxvt -title "$path" -e srw -p "$channel> " cw_color.sh "$path/out" "$path/in" "$NICK" &
	done > /dev/null 2>&1 &
fi

line="$(printf "%-30s" "$CHAN") | $(tail -n 1 "$CHAN/out")"
echo "$line" >> "$FILE"