commit d8f665bbf4c089e670d9c4e1b74ce41a0e9c98a0
parent 165b8586f2580b1cd0f94da8294876f4cd53db81
Author: sin <sin@2f30.org>
Date: Tue, 15 Apr 2014 10:11:27 +0100
All the window/pane creation happens as a response to an event
Diffstat:
5 files changed, 28 insertions(+), 37 deletions(-)
diff --git a/connectserver b/connectserver
@@ -19,6 +19,3 @@ port=$(echo $1 | awk -F: '{print $2}')
tmux new-window "ii -i irc -s $host -p $port -n $nick -f $fullname"
tmux rename-window "ii@$host"
./waitfile "irc/$host/out"
-tmux new-window "tail -f irc/$host/out | ./highlight"
-tmux split-window -p 1 "cat > irc/$host/in"
-tmux rename-window "$host"
diff --git a/hysteria b/hysteria
@@ -3,8 +3,8 @@
. ./config
rm -rf irc
-tmux new-session -s hysteria -d ./pm-monitor
-tmux rename-window "pm-monitor"
+tmux new-session -s hysteria -d ./monitor
+tmux rename-window "monitor"
for h in $hosts; do
./connectserver "$h"
diff --git a/join b/join
@@ -17,7 +17,4 @@ shift
for c in $*; do
echo "/join $c" > "irc/$host/in"
./waitfile "irc/$host/$c/out"
- tmux new-window "tail -f irc/$host/$c/out | ./highlight"
- tmux split-window -p 1 "cat > irc/$host/$c/in"
- tmux rename-window "$c"
done
diff --git a/monitor b/monitor
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Monitor for private messages and/or new channels and
+# create a new split tmux window
+
+while :; do
+ for n in $(find irc -type f -name "out" 2>/dev/null); do
+ title=$(echo $n | awk -F/ '{ \
+ if (NF == 4) \
+ print $2":"$3; \
+ else if (NF == 3) \
+ print $2}')
+ found=0
+ for t in $(tmux list-windows -F '#W'); do
+ if test "$t" == "$title"; then
+ found=1
+ fi
+ done
+ if test $found -eq 0; then
+ tmux new-window "tail -f $n | ./highlight"
+ tmux split-window -p 1 "cat > $(dirname $n)/in"
+ tmux rename-window "$title"
+ fi
+ done
+ sleep 1
+done
diff --git a/pm-monitor b/pm-monitor
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-# Monitor for private messages and create a new split tmux window
-
-while :; do
- for n in $(find irc -type f -name "out" 2>/dev/null); do
- echo $n | awk -F/ '{if (NF == 4) print $3}' | \
- grep '^#' >/dev/null 2>/dev/null
- if [ $? -eq 0 ]; then
- continue
- fi
- title=$(echo $n | awk -F/ '{if (NF == 4) print $2":"$3}')
- if test -z $title; then
- continue
- fi
- found=0
- for t in $(tmux list-windows -F '#W'); do
- if test "$t" == "$title"; then
- found=1
- fi
- done
- if test $found -eq 0; then
- tmux new-window "tail -f $n | ./highlight"
- tmux split-window -p 1 "cat > $(dirname $n)/in"
- tmux rename-window "$title"
- fi
- done
- sleep 1
-done