💾 Archived View for dots.omarpolo.com › bin › myterm.gmi captured on 2024-05-26 at 14:34:33. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-03-21)

-=-=-=-=-=-=-

myterm

#!/bin/ksh

A wrapper script to launch xterm with a cute random background color.

Got the idea from deadpixi' sam fork (the editor), where one can pass a list of colours as `background' and sam will use a random one.

I'm actually using the same list of the sam example configuration:

set -A colours white seashell oldlace lightcyan \
	lightyellow mintcream snow thistle1 wheat \
	azure lavenderblush bisque antiquewhite \
	aliceblue lemonchiffon oldlace

ksh has not a great syntax for arrays, but this will choose (with modulo bias!) a random colour and use it as xterm background.

exec xterm -bg "${colours[$((RANDOM % ${#colours[@]}))]}" "$@"