#!/bin/bash # NOTE: This script is run by cron periodically export XDG_RUNTIME_DIR="/run/user/$(id -u)" export DISPLAY=":0" NOTIFIER="/usr/bin/notify-send -u critical " # NOTIFIER="/usr/local/bin/herbe " acpi_report="$(acpi | grep -v unavailable | head -n 1)" # Battery charge check local_percent="$(echo $acpi_report | awk '{print $4}')" local_state="$(echo $acpi_report | awk '{print $3}')" local_time="$(echo $acpi_report | awk '{print $5}')" battery_message=("Warning:" "Battery VOLTAGE critical") temperature_message=("Warning:" "Core TEMPERATURE critical") $NOTIFIER "${battery_message[0]} ${battery_message[1]}" & if ((${local_percent::-2} <= 15)); then if [[ "${local_state::-1}" == "Discharging" ]]; then $NOTIFIER " ${battery_message[0]} ${battery_message[1]}" & # espeak "${battery_message[0]}${battery_message[1]}" fi fi