|
@@ -1,73 +0,0 @@
|
|
|
-#!/bin/sh
|
|
|
-
|
|
|
-energy=$(cat /sys/class/power_supply/BAT1/charge_now)
|
|
|
-full=$(cat /sys/class/power_supply/BAT1/charge_full)
|
|
|
-state=$(cat /sys/class/power_supply/BAT1/status)
|
|
|
-
|
|
|
-remainingTime=$(acpi | cut -d ',' -f3 | cut -d ' ' -f2)
|
|
|
-if [ "$remainingTime" = '' ]
|
|
|
-then
|
|
|
- remainingTime=""
|
|
|
-else
|
|
|
- hours=$(echo "$remainingTime" | cut -d':' -f1)
|
|
|
- minutes=$(echo "$remainingTime" | cut -d':' -f2)
|
|
|
- seconds=$(echo "$remainingTime" | cut -d':' -f3)
|
|
|
- timsAll=$(qalc -t -b '12 10' "round(($seconds + $minutes * 60 + $hours * 3600) * 144 / 25)")
|
|
|
- tims=$(qalc -t -b '12 12' "$timsAll % 100")
|
|
|
- m=$(qalc -t -b '12 12' "round($timsAll / 100)")
|
|
|
- dunaTims=$(qalc -t -b '12 12' "$m % 100")
|
|
|
- hours=$(qalc -t -b '12 12' "round($m / 100)")
|
|
|
- remainingTime="$hours.$dunaTims.$tims"
|
|
|
-fi
|
|
|
-
|
|
|
-duni=$(qalc -t -b '12 10' "min(round($energy / $full * 144), 144)")
|
|
|
-
|
|
|
-
|
|
|
-if [ "$state" = "Full" ]
|
|
|
-then
|
|
|
- font="Battery 13"
|
|
|
- colour="#1c9867"
|
|
|
- icon=""
|
|
|
- /home/adam/.local/bin/battery_notify 100
|
|
|
-elif [ "$state" = "Charging" ]
|
|
|
-then
|
|
|
- colour="#db9d3b"
|
|
|
- font="Battery 13"
|
|
|
- icon=$(printf '%b' "\ue$(qalc -s 'basedisp none' -t -b '16 12' "0x400 + $duni")")
|
|
|
-elif [ "$state" = "unknown" ]
|
|
|
-then
|
|
|
- colour='#e7e9f3'
|
|
|
- font='Iosevka 6'
|
|
|
- icon=""
|
|
|
-elif [ "$state" = "" ]
|
|
|
-then
|
|
|
- colour='#892b30'
|
|
|
- font='Iosevka 6'
|
|
|
- icon=""
|
|
|
-else
|
|
|
- if [ "$(qalc -b '12 12' -t "$duni < 6")" -eq 1 ]
|
|
|
- then
|
|
|
- /home/adam/.local/bin/battery_notify 6
|
|
|
- colour="#892b30"
|
|
|
- elif [ "$(qalc -b '12 12' -t "$duni < 10")" -eq 1 ]
|
|
|
- then
|
|
|
- /home/adam/.local/bin/battery_notify 10
|
|
|
- colour="#892b30"
|
|
|
- elif [ "$(qalc -b '12 12' -t "$duni < 20")" -eq 1 ]
|
|
|
- then
|
|
|
- colour="#db9d3b"
|
|
|
- else
|
|
|
- colour="#c0bcc0"
|
|
|
- fi
|
|
|
- font="Battery 13"
|
|
|
- icon=$(printf '%b' "\ue$(qalc -s 'basedisp none' -t -b '16 12' "0x100 + $duni")")
|
|
|
-fi
|
|
|
-
|
|
|
-
|
|
|
-printf "{\"text\": \"<span font='$font' color='%s'>%s</span>%s\"" "$colour" "$icon"
|
|
|
-if [ "$remainingTime" != "" ] && [ "$state" != "fully-charged" ]
|
|
|
-then
|
|
|
- echo ", \"tooltip\": \"$remainingTime\"}"
|
|
|
-else
|
|
|
- echo "}"
|
|
|
-fi
|