From aa88b06bbccaa8bdba3375a0a4b513e50c397386 Mon Sep 17 00:00:00 2001 From: koksnuss Date: Mon, 14 May 2018 10:11:19 +0200 Subject: [PATCH] durcheinander --- modules/audio | 14 +++++++++----- modules/backlight | 9 ++++++++- modules/datetime | 12 ++++++++---- modules/mic | 29 ----------------------------- 4 files changed, 25 insertions(+), 39 deletions(-) delete mode 100755 modules/mic diff --git a/modules/audio b/modules/audio index 95033e8..250d24b 100755 --- a/modules/audio +++ b/modules/audio @@ -1,16 +1,20 @@ #!/bin/bash -amixer get Master | gawk ' -match($0, /\[([0-9]+)\%\] \[(on|off)\]/, matches) { +case ${BLOCK_INSTANCE} in + mic) GET="Capture";; + *) GET="Master";; +esac +amixer get $GET | gawk ' + match($0, /\[([0-9]+)\%\] \[(on|off)\]/, matches) { audio=matches[1] } END { if (matches[2]=="off") { - printf("mute\n") - printf("\n") + printf("off \n") + print("\n") exit 33 } printf("%d%", audio) - print("\n") + printf("%d", audio) if (audio < 75) { print("#04B431\n") } else if (audio < 80) { diff --git a/modules/backlight b/modules/backlight index 1d54f84..209a1fb 100755 --- a/modules/backlight +++ b/modules/backlight @@ -4,9 +4,16 @@ if [[ -d "${DIR}acpi_video0" ]]; then DIR="${DIR}acpi_video0" elif [[ -d "${DIR}intel_backlight" ]]; then DIR="${DIR}intel_backlight" +else + echo "not found " + exit 33 fi cat "${DIR}/brightness" "${DIR}/max_brightness" | gawk ' NR==1 { cbr=$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") + } ' diff --git a/modules/datetime b/modules/datetime index fefef98..17f28b6 100755 --- a/modules/datetime +++ b/modules/datetime @@ -1,5 +1,9 @@ #!/bin/bash -full=$(date '+%A, %_d.%_m. %_H:%M:%S') -short=$(date '+%_H:%M') -echo $full -echo $short +SHORT=$(date '+%_H:%M') +FULL=$(date '+%A, %_d.%_m. %_H:%M:%S') +case ${BLOCK_INSTANCE} in + short) LONG=false ;; + *) LONG=true ;; +esac +[[ ${BLOCK_BUTTON} == 1 ]] && LONG=true +[[ "$LONG" == "true" ]] && echo $FULL || echo $SHORT diff --git a/modules/mic b/modules/mic deleted file mode 100755 index 783b43c..0000000 --- a/modules/mic +++ /dev/null @@ -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 - } - } -'