summaryrefslogtreecommitdiff
path: root/twopane.bash
blob: 6e5aeca70dffc40e1edc3255ba8875f407c5423b (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
#!/bin/bash
set -e
set -f
set -o pipefail
shopt -s lastpipe

TWOPANE=$(mktemp -d)
STY=twopane.${TWOPANE##*/}
SCREENRC=$TWOPANE/screenrc
export TWOPANE
cat > "$SCREENRC" <<'.'
unbindall
escape \0\0
caption string '%t'
layout new
split
focus top
screen -ln -t 'output' 0 nc -NUls "$TWOPANE"/socket
title 'output'
focus bottom
resize 4
# screen -ln -t 'input' 1 bash "$TWOPANE"/bashrc
screen -ln -t 'input' 1 nc -NU "$TWOPANE"/socket
layout save 0
.
cat > "$TWOPANE"/bashrc <<'.'
coproc nc -NU "$TWOPANE"/socket
bash -i 2>${COPROC[1]} <${COPROC[0]}
.

screen -c "$SCREENRC" -m -S "$STY" -ln