diff options
| author | 2021-04-10 16:12:34 +0000 | |
|---|---|---|
| committer | 2021-04-10 16:12:34 +0000 | |
| commit | 36e0597bdc938cc64ea559a4c8f330e657f95826 (patch) | |
| tree | 5d7d94cf9f7430884f90b2c8f075bcd5043ddc96 /bin | |
| parent | 565a3da2702126e7f10ccb48c3fbf2e188ef37b5 (diff) | |
Atualizado script batt e adicionadas configurações atualizadas do Alacritty'
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/batt | 9 | ||||
| -rwxr-xr-x | bin/battery_check | 29 |
2 files changed, 20 insertions, 18 deletions
@@ -2,9 +2,12 @@ batt() { batt="$(acpi | awk '{print $4}' | sed -e 's/%,//g')" - icon="" state="$(cat /sys/class/power_supply/BAT0/status)" + icon="" + + [ "$batt" -e 98 ] && icon="" + [ "$batt" -ge 90 ] && icon="" [ "$batt" -le 50 ] && icon="" @@ -13,6 +16,10 @@ batt() { [ "$batt" -le 5 ] && icon="" + [ "$state" == "Charging" ] && icon="" + + battery_check "$batt" "$state" + printf "%s %d%%" "$icon" "$batt" } diff --git a/bin/battery_check b/bin/battery_check index 7d77b82..3ee4ca1 100755 --- a/bin/battery_check +++ b/bin/battery_check @@ -2,22 +2,17 @@ # Simple script to monitor the battery's status and level -interval=300 # 5 minutes critical_level=7 -while true -do - batt="$(cat /sys/class/power_supply/BAT0/capacity)" - state="$(cat /sys/class/power_supply/BAT0/status)" - - if [[ $batt -ge 99 ]]; then - notify-send -u normal"Bateria" "Completamente carregada! (100%)"; pkill -RTMIN+20 dwmblocks - elif [[ $batt -eq 20 ]] ; then - notify-send -u normal "Bateria descarregando" "Nível de bateria alcançou 20%"; pkill -RTMIN+20 dwmblocks - elif [[ $batt -eq 10 ]] ; then - notify-send -u normal "Bateria descarregando" "Nível de bateria alcançou 10%"; pkill -RTMIN+20 dwmblocks - elif [[ $batt -le "$critical_level" ]]; then - notify-send -u critical "Bateria crítica!" "Nível de bateria alcançou 7%"; pkill -RTMIN+20 dwmblocks - fi - sleep "$interval" -done +batt="$1" +state="$2" + +if [[ $batt -ge 99 ]]; then + notify-send -u normal"Bateria" "Completamente carregada! (100%)"; pkill -RTMIN+20 dwmblocks +elif [[ $batt -eq 20 ]] ; then + notify-send -u normal "Bateria descarregando" "Nível de bateria alcançou 20%"; pkill -RTMIN+20 dwmblocks +elif [[ $batt -eq 10 ]] ; then + notify-send -u normal "Bateria descarregando" "Nível de bateria alcançou 10%"; pkill -RTMIN+20 dwmblocks +elif [[ $batt -le "$critical_level" ]]; then + notify-send -u critical "Bateria crítica!" "Nível de bateria alcançou 7%"; pkill -RTMIN+20 dwmblocks +fi |
