19 lines
1.3 KiB
Bash
19 lines
1.3 KiB
Bash
#!/bin/sh
|
|
# B13W test UI for 128x128 (inside foot): coloured corners (TL red, TR green, BL blue, BR white) + centre label + 1-cell white frame,
|
|
# so orientation, crop and colour order are visible at a glance; a typed line (VNC keyboard test) is echoed in green. Arg 1 = label.
|
|
L=${1:-WAYLAND}; T=
|
|
draw() {
|
|
set -- $(stty size 2>/dev/null); R=${1:-16}; C=${2:-21}
|
|
printf '\033[?25l\033[0m\033[2J'
|
|
cell() { printf '\033[%d;%dH\033[%sm \033[0m' $1 $2 "$3"; }
|
|
for c in $(seq 1 $C); do printf '\033[1;%dH\033[47m \033[%d;%dH\033[47m \033[0m' $c $R $c; done
|
|
for r in $(seq 1 $R); do printf '\033[%d;1H\033[47m \033[%d;%dH\033[47m \033[0m' $r $r $C; done
|
|
cell 2 2 41; cell 2 $((C-2)) 42; cell $((R-1)) 2 44; cell $((R-1)) $((C-2)) 107
|
|
printf '\033[%d;%dH\033[1;93m%s\033[0m' $((R/2-1)) $(( (C-${#L})/2 + 1 )) "$L"
|
|
printf '\033[%d;%dH\033[96m%sx%s\033[0m' $((R/2+1)) $(( (C-${#C}-${#R}-1)/2 + 1 )) "$C" "$R"
|
|
printf '\033[%d;3H\033[92m%s\033[0m' $((R-3)) "$T"
|
|
}
|
|
trap draw WINCH
|
|
s0=; for i in 1 2 3 4 5 6 7 8 9 10; do s=$(stty size 2>/dev/null); [ -n "$s" ] && [ "$s" = "$s0" ] && break; s0=$s; sleep 0.3; done
|
|
draw; stty -echo -icanon 2>/dev/null
|
|
while :; do c=$(dd bs=1 count=1 2>/dev/null) || continue; case "$c" in '') T=;; *) T="$T$c";; esac; R=$(stty size | cut -d' ' -f1); printf '\033[%d;3H\033[K\033[92m%s\033[0m' $((R-3)) "$T"; done
|