diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-08-10 14:01:22 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-08-10 14:01:22 +0200 |
commit | 83932d1c5d3e538eb543b73bbdf6dfa339530da3 (patch) | |
tree | f5d5e505d600512c07e3b9e4d872059273c8b2fd /tq | |
parent | 62bf9cc5a08d524c2acaff22c34ff5c6943e2454 (diff) | |
download | nq-83932d1c5d3e538eb543b73bbdf6dfa339530da3.tar.gz nq-83932d1c5d3e538eb543b73bbdf6dfa339530da3.tar.xz nq-83932d1c5d3e538eb543b73bbdf6dfa339530da3.zip |
tq: add screen(1) support
Diffstat (limited to 'tq')
-rwxr-xr-x | tq | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tq b/tq index 882a8b8..b3449c4 100755 --- a/tq +++ b/tq @@ -1,5 +1,5 @@ #!/bin/sh -# tq CMD... - tmux wrapper for nq to display output in new window +# tq CMD... - tmux/screen wrapper for nq to display output in new window set -e @@ -8,10 +8,18 @@ p=${s##*.} printf '%s\n' "$s" -if [ -n "$p" ] && [ -n "$TMUX" ]; then - tmux new-window -a -d -n '<' -c '#{pane_current_path}' \ - "trap true INT QUIT TERM EXIT; - fq $s || kill $p; - printf '[%d exited, ^D to exit.]\n' $p; - cat >/dev/null" +if [ -n "$p" ]; then + if [ -n "$TMUX" ]; then + tmux new-window -a -d -n '<' -c '#{pane_current_path}' \ + "trap true INT QUIT TERM EXIT; + fq $s || kill $p; + printf '[%d exited, ^D to exit.]\n' $p; + cat >/dev/null" + elif [ -n "$STY" ]; then + screen -t '<' sh -c "trap true INT QUIT TERM EXIT; + fq $s || kill $p + printf '[%d exited, ^D to exit.]\n' $p; + cat >/dev/null" + screen -X other + fi fi |