add mic support

This commit is contained in:
koksnuss 2018-05-14 00:19:36 +02:00
parent d1571c5592
commit 3286537e14
3 changed files with 33 additions and 5 deletions

View File

@ -31,7 +31,7 @@ storage df
- [x] audio
- [x] fix audio not changing on mute
- [x] cpu
- [x] brightness
- [x] backlight
- [ ] swap
- [ ] wifi/ethernet/bluetooth
- [ ] external storage with mount

7
config
View File

@ -7,7 +7,6 @@ interval=5
[backlight]
label=backlight
interval=2
[storage]
label=storage
@ -16,7 +15,6 @@ label=storage
label=ram
[cpu]
interval=2
label=cpu
[ip]
@ -29,9 +27,10 @@ separator_block_width=5
[battery]
instance=1
[mic]
label=mic
[audio]
interval=1
label=audio
[datetime]
interval=1

29
mic Executable file
View File

@ -0,0 +1,29 @@
#!/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
}
}
'