#!/bin/bash amixer get Capture | gawk ' match($0, /\[([0-9]+)\%\] \[(on|off)\]/, matches) { mic=matches[1] } END { if (matches[2]=="off") { printf("mute\n") printf("\n") exit 33 } printf("%d%", mic) print("\n") if (mic < 75) { print("#04B431\n") } else if (mic < 80) { print("#A8FF00\n") } else if (mic < 85) { print("#FFF600\n") } else if (mic < 90) { print("#FFAE00\n") } else if (mic < 95) { print("#FF0000\n") } else { exit 33 } } '