aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGravatar Matheus R <matheusrbarros03@gmail.com> 2021-04-10 16:12:34 +0000
committerGravatar Matheus R <matheusrbarros03@gmail.com> 2021-04-10 16:12:34 +0000
commit36e0597bdc938cc64ea559a4c8f330e657f95826 (patch)
tree5d7d94cf9f7430884f90b2c8f075bcd5043ddc96 /bin
parent565a3da2702126e7f10ccb48c3fbf2e188ef37b5 (diff)
Atualizado script batt e adicionadas configurações atualizadas do Alacritty'
Diffstat (limited to 'bin')
-rwxr-xr-xbin/batt9
-rwxr-xr-xbin/battery_check29
2 files changed, 20 insertions, 18 deletions
diff --git a/bin/batt b/bin/batt
index 0e88611..10d992b 100755
--- a/bin/batt
+++ b/bin/batt
@@ -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