summaryrefslogblamecommitdiffstats
path: root/.bin/term-color
blob: 45a2dccfed518340d1938a5df846ecf7e35d549a (plain) (tree)



































                                                     
#!/bin/sh

set -xe

sequences="${HOME}/.config/dot/term-color"
cache_file="${HOME}/.cache/dot/sequences"

if [ "${1}" = "-l" ]; then
	sequences="${sequences}-light"
else
	sequences="${sequences}-dark"
fi

[ -f "${sequences}" ]

case $(uname) in
	OpenBSD)
		ttys=$(ps |
			tail -n +2 |
			tr -s " " |
			sed 's/^ //g' |
			cut -d " " -f 2 |
			sed 's/-$//g' |
			uniq |
			sed 's/^/\/dev\/tty/g')
		;;
	Linux)
		ttys=$(find /dev/pts -iname "[0-9]*")
		;;
esac

for tty in $ttys; do
	[ -c "${tty}" ] && cat "${sequences}" > $tty
done

cp "${sequences}" "${cache_file}"
remember that computers suck.