summaryrefslogtreecommitdiff
path: root/twopane.bash
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2024-07-31 15:12:03 -0400
committerAndrew Cady <d@jerkface.net>2024-07-31 15:12:03 -0400
commitb1107e4a5fdb949d695686866ea61cb1c21519be (patch)
tree0a4eb2932bb11136580bfb4cf7536591580184bb /twopane.bash
parent9a705de16bc9e3ddf0a80b806ee1f76acff1485f (diff)
experiments
doesn't quite work can't launch top for tty issue need to call bash -i from opposite side to inherit the screen terminal also the COPROC fd is not inherited, wtf?
Diffstat (limited to 'twopane.bash')
-rw-r--r--twopane.bash39
1 files changed, 32 insertions, 7 deletions
diff --git a/twopane.bash b/twopane.bash
index 6e5aeca..59b8d4b 100644
--- a/twopane.bash
+++ b/twopane.bash
@@ -5,27 +5,52 @@ set -o pipefail
5shopt -s lastpipe 5shopt -s lastpipe
6 6
7TWOPANE=$(mktemp -d) 7TWOPANE=$(mktemp -d)
8export TWOPANE
9trap 'rm -r "$TWOPANE"' EXIT
8STY=twopane.${TWOPANE##*/} 10STY=twopane.${TWOPANE##*/}
9SCREENRC=$TWOPANE/screenrc 11SCREENRC=$TWOPANE/screenrc
10export TWOPANE
11cat > "$SCREENRC" <<'.' 12cat > "$SCREENRC" <<'.'
12unbindall 13unbindall
13escape \0\0 14escape \0\0
15escape ``
14caption string '%t' 16caption string '%t'
15layout new 17layout new
16split 18split
17focus top 19focus top
18screen -ln -t 'output' 0 nc -NUls "$TWOPANE"/socket 20screen -ln -t 'output' 0 sh -c 'socat -U STDOUT UNIX-RECV:"$TWOPANE"/socket; screen -X quit'
19title 'output' 21title 'output'
20focus bottom 22focus bottom
21resize 4 23resize 8
22# screen -ln -t 'input' 1 bash "$TWOPANE"/bashrc 24focus top
23screen -ln -t 'input' 1 nc -NU "$TWOPANE"/socket 25fit
26focus bottom
27screen -ln -t 'input' 1 bash "$TWOPANE"/bashrc
24layout save 0 28layout save 0
25. 29.
30
26cat > "$TWOPANE"/bashrc <<'.' 31cat > "$TWOPANE"/bashrc <<'.'
27coproc nc -NU "$TWOPANE"/socket 32set -e
28bash -i 2>${COPROC[1]} <${COPROC[0]} 33trap "screen -X quit" EXIT
34coproc socat -u SYSTEM:"bash -i",pty,ctty,setsid,stderr,cloexec=0 UNIX-SENDTO:"$TWOPANE"/socket
35exec 30>&${COPROC[1]}
36send()
37{
38 printf '%s\n' "$*" >&30
39}
40sendc()
41{
42 printf '%s' "$*" >&30
43}
44send echo hello world
45sendc echo hello
46sleep 1
47send world2
48sleep 1
49send top
50export -f send sendc
51bash -i || true
52send echo hello world3
53sleep 1
29. 54.
30 55
31screen -c "$SCREENRC" -m -S "$STY" -ln 56screen -c "$SCREENRC" -m -S "$STY" -ln