aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/batt20
-rwxr-xr-xbin/cpu3
2 files changed, 8 insertions, 15 deletions
diff --git a/bin/batt b/bin/batt
index d61ce16..991f249 100755
--- a/bin/batt
+++ b/bin/batt
@@ -9,25 +9,19 @@ batt() {
icon=""
- if [ "$state" -eq "Discharging" ]; then
+ [ "$batt" -le 7 ] && icon="" && [ "$notif" -eq 0 ] && notify-send -u critical 'Bateria crítica!' 'Bateria atingiu 7%' && notif=1
- [ "$batt" -le 7 ] && icon="" && [ notif -eq 0 ] && notify-send -u critical 'Bateria crítica!' 'Bateria atingiu 7%' && "$notif"=1
+ [ "$batt" -le 10 ] && icon="" && [ "$notif" -eq 0 ] && notify-send 'Bateria descarregando' 'Bateria atingiu 10%' && notif=1
- [ "$batt" -ge 7 ] && [ "$batt" -le 10 ] && icon="" && [ "$notif" -eq 0 ] && notify-send 'Bateria descarregando' 'Bateria atingiu 10%' && "$notif"=1
+ [ "$batt" -le 20 ] && [ "$batt" -ge 10 ] && icon="" && [ "$notif" -eq 0 ] && notify-send 'Bateria descarregando' 'Bateria atingiu 20%' && notif=1
- [ "$batt" -ge 10 ] && [ "$batt" -le 20 ] && icon="" && [ "$notif" -eq 0 ] && notify-send 'Bateria descarregando' 'Bateria atingiu 20%' && "$notif"=1
+ [ "$batt" -le 50 ] && icon=""
- [ "$batt" -ge 20 ] && [ "$batt" -le 50 ] && icon=""
+ [ "$batt" -ge 90 ] && icon=""
- [ "$batt" -le 96 ] && [ "$batt" -ge 90 ] && icon=""
+ [ "$state" = "Charging" ] && icon=""
- [ "$batt" -ge 96 ] && icon=""
-
- elif [ "$state" -eq "Charging" ]; then
- icon=""
-
- [ "$batt" -ge 98 ] && notify-send 'Bateria completamente carregada!' 'Bateria alcançou 100%' && icon=""
- fi
+ [ "$state" = "Full" ] && icon="" && notify-send && notify-send 'Bateria completamente carregada!' 'Bateria alcançou 100%' && notif=1
printf "%s %d%%" "$icon" "$batt"
}
diff --git a/bin/cpu b/bin/cpu
index 657546b..a0a4511 100755
--- a/bin/cpu
+++ b/bin/cpu
@@ -2,8 +2,7 @@
# checks the amount of CPU being used
cpu() {
- cpu="$(awk '{u=$2+$4; t=$2+$4+$5; if (NR==1){u1=u; t1=t;} else print ($2+$4-u1) * 100 / (t-t1); }' \
- <(grep 'cpu ' /proc/stat) <(sleep 1;grep 'cpu ' /proc/stat))"
+ cpu="$(cat /proc/loadavg | awk '{print $3}'|cut -f 1 -d ".")"
printf "﬙ %.0f%%" "$cpu"
}