[dev] Re: experimenting with ii, question about a script

From: Greg Reagle <greg.reagle_AT_umbc.edu>
Date: Sat, 22 Feb 2020 12:47:42 -0500

Now it works with pcw! Very much like lchat.

Put this in pcw_win.sh:
exec dvtm-ii "$CPATH"

and here is the script, which I named dvtm-ii

#!/bin/sh
set -u

trap cleanup INT TERM QUIT
cleanup() { kill $!; } # make st end when this script does

[ -d "$1" -a -r "$1"/out -a -p "$1"/in ] || exit 1
cmd_fifo=$(mktemp -u) || exit 1
mkfifo "$cmd_fifo" || exit 1
title="$(basename $(dirname "$1"))/$(basename "$1")"
st -e dvtm -M -h 10000 -t "$title" -c "$cmd_fifo" "exec nano -nw \"$1/in\"" "exec tail -n +0 -f \"$1\"/out" &

delay="0.09" # dvtm crashes unless pause at leat 0.07 seconds
# I had to customize dvtm to allow these commands to the command fifo, and it
# was very easy to do so. They are based on the keyboard commands. If you
# haven't customized dvtm, you can just comment out this next paragraph
{
        for cmd in b j l l l l l l; do
                sleep "$delay"
                echo "$cmd"
        done
} >"$cmd_fifo"

wait # wait for st
Received on Sat Feb 22 2020 - 18:47:42 CET

This archive was generated by hypermail 2.3.0 : Sat Feb 22 2020 - 19:00:08 CET