diff options
Diffstat (limited to 'bin/cursor')
| -rwxr-xr-x | bin/cursor | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/cursor b/bin/cursor new file mode 100755 index 0000000..2ae069b --- /dev/null +++ b/bin/cursor @@ -0,0 +1,24 @@ +#!/bin/sh + +# Set cursor in xterm and compatibles. + +usage="Usage: $0 [black | blue | cyan | gray | green | magenta | orange | red | white | yellow]" + +cursor() { + case $1 in + (0|r|red) set -- '#f00' ;; + (1|n|green) set -- '#5f5' ;; + (2|b|blue) set -- '#55f' ;; + (3|c|cyan) set -- '#0ff' ;; + (4|y|yellow) set -- '#ff0' ;; + (5|m|magenta) set -- '#f0f' ;; + (6|o|orange) set -- '#f80' ;; + (7|g|gr[ae]y) set -- '#888' ;; + (k|black) set -- '#111' ;; + (w|white) set -- '#eee' ;; + esac + printf '\e[2 q\e]12;'$1'\e\' # set non blinking block, then color +} + +case $1 in -*) echo "$usage" >&2; exit 1;; esac +cursor "${1:-$((RANDOM % 8))}" |
