diff options
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | tq | 22 |
2 files changed, 18 insertions, 10 deletions
diff --git a/README.md b/README.md index 4a3e324..cc5fa41 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,10 @@ Two helper programs are provided: jobs are done. If no job is running, the output of the last job is shown. `fq -a` shows the output of all jobs, `fq -q` only shows one line per job. `fq` uses `inotify` on Linux and falls back to polling -for size change else. `fq.sh` is a similar tool, not quite as robust, -implemented as shell-script calling `tail`. +for size change else. (`fq.sh` is a similar tool, not quite as robust, +implemented as shell-script calling `tail`.) -`tq` wraps `nq` and displays the `fq` output in a new tmux window. +`tq` wraps `nq` and displays the `fq` output in a new tmux or screen window. (A pure shell implementation of `nq` is provided as `nq.sh`. It needs `flock` from util-linux, and only has a timer resolution of 1s. 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 |