59 lines
1.6 KiB
Bash
Executable File
59 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
[[ "$BLOCK_INSTANCE" == "mic" ]] && DEV="Capture" || DEV="Master"
|
|
|
|
[[ "$BLOCK_BUTTON" == 1 ]] && LONG=true
|
|
|
|
|
|
[[ "$BLOCK_BUTTON" == 2 ]] && amixer set $DEV toggle &> /dev/null
|
|
|
|
amixer get $DEV | gawk -v LONG="$LONG" '
|
|
match($0, /\[([0-9]+)\%\] \[(on|off)\]/, matches) {
|
|
load=matches[1]
|
|
}
|
|
END {
|
|
if (matches[2] == "off") {
|
|
print("off\n")
|
|
print("X\n")
|
|
print("#CCCCCC")
|
|
}
|
|
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 (load < 80) {
|
|
print("#A8FF00\n")
|
|
} else if (load < 85) {
|
|
print("#FFF600\n")
|
|
} else if (load < 90) {
|
|
print("#FFAE00\n")
|
|
} else if (load < 95) {
|
|
print("#FF0000\n")
|
|
} else {
|
|
exit 33
|
|
}
|
|
}
|
|
'
|