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 | |
parent | 62bf9cc5a08d524c2acaff22c34ff5c6943e2454 (diff) | |
download | nq-83932d1c5d3e538eb543b73bbdf6dfa339530da3.tar.gz nq-83932d1c5d3e538eb543b73bbdf6dfa339530da3.tar.xz nq-83932d1c5d3e538eb543b73bbdf6dfa339530da3.zip |
tq: add screen(1) support
-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 |