diff options
Diffstat (limited to '.bin/term-color')
-rwxr-xr-x | .bin/term-color | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/.bin/term-color b/.bin/term-color new file mode 100755 index 0000000..45a2dcc --- /dev/null +++ b/.bin/term-color @@ -0,0 +1,36 @@ +#!/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}" |