From f130384cd8e7f894a29b6412ea36b31f72d4e771 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Mon, 6 Jan 2025 18:01:45 +0100 Subject: update --- bin/cursor | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'bin/cursor') diff --git a/bin/cursor b/bin/cursor index 6fdbc12..537c164 100755 --- a/bin/cursor +++ b/bin/cursor @@ -1,22 +1,24 @@ -#!/bin/bash +#!/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 - (r|red) cc='#f00' ;; - (n|green) cc='#5f5' ;; - (b|blue) cc='#55f' ;; - (c|cyan) cc='#0ff' ;; - (y|yellow) cc='#ff0' ;; - (m|magenta) cc='#f0f' ;; - (o|orange) cc='#f80' ;; - (k|black) cc='#111' ;; - (g|gr[ae]y) cc='#888' ;; - (w|white) cc='#eee' ;; - (*) cc=$1 ;; + (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 } -cursor "${1:-red}" -printf '\e]12;'$cc'\e\' # set cursor color +case $1 in -*) echo "$usage" >&2; exit 1;; esac +cursor "${1:-$((RANDOM % 8))}" -- cgit v1.2.3