Improved block colors and added battery_button

This commit is contained in:
Ashish Kumar Yadav 2020-07-27 01:01:24 +05:30
parent 6b91bce853
commit 3fb75e8ae9
6 changed files with 46 additions and 11 deletions

View file

@ -1,3 +1,3 @@
#!/bin/sh #!/bin/sh
read -r capacity </sys/class/power_supply/BAT0/capacity read -r capacity </sys/class/power_supply/BAT0/capacity
echo "${capacity}%" echo " ${capacity}%"

View file

@ -1,6 +1,41 @@
#!/bin/sh #!/bin/sh
case "$1" in
1) exec termite -e "htop -s PERCENT_CPU" ;; read -r rate </sys/class/power_supply/BAT0/current_now
2) exec termite -e "htop" ;; [ "$rate" = 0 ] && notify-send "Battery fully charged" && exit
3) exec termite -e "htop -s PERCENT_MEM" ;;
read -r ac </sys/class/power_supply/AC/online
read -r charge_now </sys/class/power_supply/BAT0/charge_now
if [ "$ac" = 1 ] ; then
read -r charge_full </sys/class/power_supply/BAT0/charge_full
val=$(( charge_full-charge_now ))
else
val=$charge_now
fi
hr=$(( val / rate ))
mn=$(( (val * 60) / rate - hr * 60 ))
case "$hr" in
0)
case "$mn" in
0) notify-send "Battery fully charged" ;;
1) notify-send "1 minute remaining" ;;
*) notify-send "$mn minutes remaining" ;;
esac
;;
1)
case "$mn" in
0) notify-send "1 hour remaining" ;;
1) notify-send "1 hour, 1 minute remaining" ;;
*) notify-send "1 hour, $mn minutes remaining" ;;
esac
;;
*)
case "$mn" in
0) notify-send "$hr hours remaining" ;;
1) notify-send "$hr hours, 1 minute remaining" ;;
*) notify-send "$hr hours, $mn minutes remaining" ;;
esac
;;
esac esac

View file

@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
echo "$(date '+%a, %d %b')" echo " $(date '+%a, %d %b')"

View file

@ -6,7 +6,7 @@ read -r temp </sys/class/thermal/thermal_zone0/temp
temp=${temp%???} temp=${temp%???}
if [ "$temp" -ge "$crit" ] ; then if [ "$temp" -ge "$crit" ] ; then
echo "${temp}°C" echo " ${temp}°C"
else else
echo "${temp}°C" echo " ${temp}°C"
fi fi

View file

@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
echo "$(date '+%H:%M')" echo " $(date '+%H:%M')"

View file

@ -3,7 +3,7 @@
volstat=$(pamixer --get-mute --get-volume) volstat=$(pamixer --get-mute --get-volume)
if "${volstat% *}" ; then if "${volstat% *}" ; then
echo "${volstat#* }%" echo " ${volstat#* }%"
else else
echo "${volstat#* }%" echo " ${volstat#* }%"
fi fi