From 83932d1c5d3e538eb543b73bbdf6dfa339530da3 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Mon, 10 Aug 2015 14:01:22 +0200 Subject: tq: add screen(1) support --- tq | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'tq') 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 -- cgit 1.4.1