summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2024-08-14 10:25:40 -0400
committerAndrew Cady <d@jerkface.net>2024-08-14 10:25:44 -0400
commitcedb6ec9fd6cf108acf2e41991c40061e89a671c (patch)
tree9a79b2885cafdcf89c27d1cee544b03320eaeae8
parent0103c20f9db5332bba8962c63ac25981cafc9651 (diff)
forward() will restart top process if necessary
it issues a warning if so
-rwxr-xr-xtwopane.bash17
1 files changed, 13 insertions, 4 deletions
diff --git a/twopane.bash b/twopane.bash
index ed9b83c..45b9739 100755
--- a/twopane.bash
+++ b/twopane.bash
@@ -57,9 +57,14 @@ screen -ln -t "$BOT_TITLE" 0 bash --noprofile --rcfile "$TWOPANE"/bashrc -i
57layout save 0 57layout save 0
58. 58.
59 59
60check_top()
61{
62 screen -p1 -Q info >/dev/null
63}
64
60kill_top() 65kill_top()
61{ 66{
62 while screen -p1 -Q info >/dev/null 67 while check_top
63 do 68 do
64 screen -p1 -X kill 69 screen -p1 -X kill
65 done 70 done
@@ -67,7 +72,7 @@ kill_top()
67 72
68start_top() 73start_top()
69{ 74{
70 if screen -p1 -Q info >/dev/null 75 if check_top
71 then 76 then
72 return 77 return
73 fi 78 fi
@@ -197,8 +202,11 @@ forward()
197 202
198forward_input() 203forward_input()
199{ 204{
200 old_stty=$(stty -g) 205 if ! check_top
201 exec 100<&0 101>&1 206 then
207 echo "$0: Warning: Nothing to forward. Starting anew." >&2
208 background "$@"
209 fi
202 focus top 210 focus top
203 socat FD:100,cfmakeraw!!STDOUT - <&$stdin | 211 socat FD:100,cfmakeraw!!STDOUT - <&$stdin |
204 tee >(output_filter | soft_cursor >&101) >&$stdout 212 tee >(output_filter | soft_cursor >&101) >&$stdout
@@ -279,6 +287,7 @@ our_bashrc_main()
279} 287}
280 288
281save_file bashrc <<. 289save_file bashrc <<.
290BASH_ARGV0=twopane
282${TOP_CMD@A} 291${TOP_CMD@A}
283${BOT_CMD@A} 292${BOT_CMD@A}
284${TOP_TITLE@A} 293${TOP_TITLE@A}