add vertical box bar as default visual representaion for percentages
This commit is contained in:
@ -1,30 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $BLOCK_INSTANCE == "mic" ]] && DEV="Capture" || DEV="Master"
|
||||
[[ "$BLOCK_INSTANCE" == "mic" ]] && DEV="Capture" || DEV="Master"
|
||||
|
||||
[[ $BLOCK_BUTTON == 1 ]] && amixer set $DEV toggle &> /dev/null
|
||||
[[ "$BLOCK_BUTTON" == 1 ]] && LONG=true
|
||||
|
||||
amixer get $DEV | gawk '
|
||||
|
||||
[[ "$BLOCK_BUTTON" == 2 ]] && amixer set $DEV toggle &> /dev/null
|
||||
|
||||
amixer get $DEV | gawk -v LONG="$LONG" '
|
||||
match($0, /\[([0-9]+)\%\] \[(on|off)\]/, matches) {
|
||||
audio=matches[1]
|
||||
load=matches[1]
|
||||
}
|
||||
END {
|
||||
if (matches[2] == "off") {
|
||||
print(" off \n")
|
||||
print("off\n")
|
||||
exit 33
|
||||
print("X\n")
|
||||
print("#CCCCCC")
|
||||
}
|
||||
printf("%d% \n", audio)
|
||||
printf("%d%\n", audio)
|
||||
if (audio < 75) {
|
||||
if (LONG == "true") {
|
||||
printf("%d% \n", load)
|
||||
printf("%d%\n", load)
|
||||
} else {
|
||||
if (load < 100 / 9) {
|
||||
printf("▁\n▁\n")
|
||||
} else if (load < 100 / 9 * 2 ) {
|
||||
printf("▁\n▁\n")
|
||||
} else if (load < 100 / 9 * 3 ) {
|
||||
printf("▂\n▂\n")
|
||||
} else if (load < 100 / 9 * 4 ) {
|
||||
printf("▃\n▃\n")
|
||||
} else if (load < 100 / 9 * 5 ) {
|
||||
printf("▄\n▄\n")
|
||||
} else if (load < 100 / 9 * 6 ) {
|
||||
printf("▅\n▅\n")
|
||||
} else if (load < 100 / 9 * 7 ) {
|
||||
printf("▆\n▆\n")
|
||||
} else if (load < 100 / 9 * 8 ) {
|
||||
printf("▇\n▇\n")
|
||||
} else {
|
||||
printf("█\n█\n")
|
||||
}
|
||||
}
|
||||
if (load < 75) {
|
||||
print("#04B431\n")
|
||||
} else if (audio < 80) {
|
||||
} else if (load < 80) {
|
||||
print("#A8FF00\n")
|
||||
} else if (audio < 85) {
|
||||
} else if (load < 85) {
|
||||
print("#FFF600\n")
|
||||
} else if (audio < 90) {
|
||||
} else if (load < 90) {
|
||||
print("#FFAE00\n")
|
||||
} else if (audio < 95) {
|
||||
} else if (load < 95) {
|
||||
print("#FF0000\n")
|
||||
} else {
|
||||
exit 33
|
||||
|
Reference in New Issue
Block a user