commit 584e542814fe57a3090c88788e20cbe60be1f8a7
parent e66fe3450d681e95c3666e17c9a0d98863bd470b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sun, 25 May 2014 13:46:27 +0200
monitor: check for "in" files for active channels.
this way you can patch ii to remove the "in" file when you leave a
channel and the tmux input pane will be closed. This is both compatible
with the upstream ii (unpatched) and my (temporary) ii fork.
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/monitor b/monitor
@@ -10,8 +10,8 @@ else
fi
while :; do
- for n in $(find "$ircdir" -type f -name "out" 2>/dev/null); do
- title=$(echo $n | awk -F/ '{ \
+ for n in $(find "$ircdir" -name "in" | sort -r 2>/dev/null); do
+ title=$(printf '%s' "$n" | awk -F/ '{ \
if (NF == 4) \
print $2":"$3; \
else if (NF == 3) \
@@ -24,8 +24,10 @@ while :; do
fi
done
if test $found -eq 0; then
- tmux new-window "tail -f $n | ./highlight"
- tmux split-window -p 1 "cat > $(dirname $n)/in"
+ infile="$n"
+ outfile="$(dirname $n)/out"
+ tmux new-window "tail -f '$outfile' | ./highlight"
+ tmux split-window -p 1 "cat > '$infile'"
tmux rename-window "$title"
fi
done