summaryrefslogtreecommitdiff
path: root/twopane.bash
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2024-07-31 23:10:42 -0400
committerAndrew Cady <d@jerkface.net>2024-07-31 23:10:42 -0400
commitfce0daebb803bf903daf861c236b9d5f80774609 (patch)
treebcef1c1cb710050518a89a76edd02234d9c53fdd /twopane.bash
parent9e7a570e35f244ff4dd9f498b686da1a41614daa (diff)
fix everything
Diffstat (limited to 'twopane.bash')
-rw-r--r--twopane.bash19
1 files changed, 11 insertions, 8 deletions
diff --git a/twopane.bash b/twopane.bash
index 5ba1264..876fc50 100644
--- a/twopane.bash
+++ b/twopane.bash
@@ -33,14 +33,14 @@ layout new
33split 33split
34focus bottom 34focus bottom
35resize $BOT_SIZE 35resize $BOT_SIZE
36screen -ln -t "$BOT_TITLE" 0 bash --noprofile --rcfile "$TWOPANE"/bashrc -x -i 36screen -ln -t "$BOT_TITLE" 0 bash --noprofile --rcfile "$TWOPANE"/bashrc -i
37 37
38source "$TWOPANE"/screenrc.startpane 38source "$TWOPANE"/screenrc.startpane
39. 39.
40 40
41save_screenrc 'startpane' <<'.' 41save_screenrc 'startpane' <<'.'
42focus top 42focus top
43screen -ln -t "$TOP_TITLE" 1 sh -c "$TOP_CMD; screen -X focus top; screen -X remove" 43screen -ln -t "$TOP_TITLE" 1 sh -c "$TOP_CMD"
44exec :!. socat -u UNIX-RECV:"$TWOPANE"/socket STDOUT 44exec :!. socat -u UNIX-RECV:"$TWOPANE"/socket STDOUT
45title 'output' 45title 'output'
46focus bottom 46focus bottom
@@ -69,29 +69,32 @@ sendp()
69} 69}
70sendc() 70sendc()
71{ 71{
72 [ "${COPROC[1]}" ] || coproc sendp
72 printf '%s' "$*" >&${COPROC[1]} 73 printf '%s' "$*" >&${COPROC[1]}
73} 74}
74send() 75send()
75{ 76{
77 [ "${COPROC[1]}" ] || coproc sendp
76 printf '%s' "$*"$'\n' >&${COPROC[1]} 78 printf '%s' "$*"$'\n' >&${COPROC[1]}
77} 79}
78start() 80start()
79{ 81{
80 while read -r -N1 82 [ "${COPROC[1]}" ] || coproc sendp
83 while read -r -N1 </dev/tty
81 do 84 do
82 printf '%s' "$REPLY" >&${COPROC[1]} 85 [ "${COPROC[1]}" ] || break
83 done 86 printf '%s' "$REPLY"
87 done >&${COPROC[1]}
84} 88}
85 89
86save_file bashrc <<. 90save_file bashrc <<.
87set -x
88set -f 91set -f
89set -o pipefail 92set -o pipefail
90shopt -s lastpipe 93shopt -s lastpipe
94trap 'COPROC=()' SIGPIPE
91trap "screen -X quit" EXIT 95trap "screen -X quit" EXIT
92$(declare -f $TWOPANE_FUNCTION_EXPORTS) 96$(declare -f $TWOPANE_FUNCTION_EXPORTS | sed 's/ COPROC / /')
93export PS1="$BOT_TITLE\$ " 97export PS1="$BOT_TITLE\$ "
94coproc sendp
95. 98.
96 99
97main() 100main()