summaryrefslogtreecommitdiffstats
path: root/.local/bin/status/sb-battery
blob: 2fe3ce58ef048e6eea27cc828b28fca63de01123 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

case $(hostname -s) in
	mother) exit ;;
	po-rbo)
		printf "^c#fabd2f^"
		charge=$(cat /sys/class/power_supply/BAT0/capacity)
		case "$(cat /sys/class/power_supply/BAT0/status)" in
			"Charging"|"Not charging") printf "󱐋 " ;;
			"Full") printf "󱐋 "; return ;;
		esac
		;;
	mars)
		echo -n "^c#fabd2f^"
		charge=$(apm -l)
		[ "$(apm -b)" -eq 3 ] && printf "󱐋 "
		;;
esac

case $(echo "$charge" / 20 | bc) in
	"0") printf " " ;;
	"1") printf " " ;;
	"2") printf " " ;;
	"3") printf " " ;;
	"4")
		[ "$charge" -gt 98 ] && return
		printf " "
		;;
	"5")
		[ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && return
		printf "󱐋"
		;;
esac