-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpws-rlist
executable file
·57 lines (49 loc) · 1.17 KB
/
cpws-rlist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#! /bin/bash
CKSCA="$XDG_CACHE_HOME/conky-pywal-scheme"
# the only line that needs bash kus cant figure out this shit every, thing else should be posix
###
__=""
_stdin=""
read -N1 -t1 __ && {
(( $? <= 128 )) && {
IFS= read -rd '' _stdin
STDIN="$__$_stdin"
}
}
###
SELclr(){
case $1 in
"dim"|"bright"|"normal")
CLBRI="$1"
shift ;;
*)
CLBRI=$(shuf -e dim bright normal -n1)
esac
if [ -n "$1" ] ; then
cat "$CKSCA/$CLBRI/color$(shuf "$@" -n1)"
else
cat "$CKSCA/$CLBRI/color$(shuf -i 0-15 -n1)"
fi
}
RNDclrlist(){
IFS='
'
for STDLINE in $STDIN ; do
echo "$(SELclr "$@")$STDLINE"
done
}
PNThelp(){
printf '%s\n' \
'Usage: cpws-rlist [brightness] [shuf args] [numder range or list 0-15] '
' --help -h "Show Help, also shows if nothing was piped in, dont do that, its slow" '\
' "" "grabs color code for conky, any feild left blank is randomized"'\
' normal dim bright "color brightness"'\
' this uses the shuf command, in a range 1-15 type man shuf in the treminal for more details= "Pywal/Terminal color value"'
}
[ -z "$STDIN" ] && PNThelp && exit
case $1 in
"--help"|"-h")
PNThelp ;;
*)
RNDclrlist $@
esac