durcheinander

This commit is contained in:
koksnuss 2018-05-14 10:11:19 +02:00
parent 2077f89897
commit aa88b06bbc
4 changed files with 25 additions and 39 deletions

View File

@ -1,16 +1,20 @@
#!/bin/bash #!/bin/bash
amixer get Master | gawk ' case ${BLOCK_INSTANCE} in
match($0, /\[([0-9]+)\%\] \[(on|off)\]/, matches) { mic) GET="Capture";;
*) GET="Master";;
esac
amixer get $GET | gawk '
match($0, /\[([0-9]+)\%\] \[(on|off)\]/, matches) {
audio=matches[1] audio=matches[1]
} }
END { END {
if (matches[2]=="off") { if (matches[2]=="off") {
printf("mute\n") printf("off \n")
printf("\n") print("\n")
exit 33 exit 33
} }
printf("%d%", audio) printf("%d%", audio)
print("\n") printf("%d", audio)
if (audio < 75) { if (audio < 75) {
print("#04B431\n") print("#04B431\n")
} else if (audio < 80) { } else if (audio < 80) {

View File

@ -4,9 +4,16 @@ if [[ -d "${DIR}acpi_video0" ]]; then
DIR="${DIR}acpi_video0" DIR="${DIR}acpi_video0"
elif [[ -d "${DIR}intel_backlight" ]]; then elif [[ -d "${DIR}intel_backlight" ]]; then
DIR="${DIR}intel_backlight" DIR="${DIR}intel_backlight"
else
echo "not found "
exit 33
fi fi
cat "${DIR}/brightness" "${DIR}/max_brightness" | gawk ' cat "${DIR}/brightness" "${DIR}/max_brightness" | gawk '
NR==1 { cbr=$1 } NR==1 { cbr=$1 }
NR==2 { mbr=$1 } NR==2 { mbr=$1 }
END { printf("%d%", cbr/mbr*100) } END {
printf("%d%\n", cbr/mbr*100)
printf("%d\n", cbr/mbr*100)
print("\n")
}
' '

View File

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
full=$(date '+%A, %_d.%_m. %_H:%M:%S') SHORT=$(date '+%_H:%M')
short=$(date '+%_H:%M') FULL=$(date '+%A, %_d.%_m. %_H:%M:%S')
echo $full case ${BLOCK_INSTANCE} in
echo $short short) LONG=false ;;
*) LONG=true ;;
esac
[[ ${BLOCK_BUTTON} == 1 ]] && LONG=true
[[ "$LONG" == "true" ]] && echo $FULL || echo $SHORT

View File

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