summaryrefslogtreecommitdiff
path: root/.config/eww/scripts/battery
blob: 99059491aa1213a15f92614ba8764a9ab1c2c089 (plain) (blame)
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
#!/bin/sh

set -e

awk '
	{
		printf "percentage=%d%%\n", $0
		printf "icon="
		if ($1 == "Charging")
			print "󰂄"
		else if ($0 >= 90)
			print "󰁹"
		else if ($0 >= 80)
			print "󰂂"
		else if ($0 >= 70)
			print "󰂁"
		else if ($0 >= 60)
			print "󰁿"
		else if ($0 >= 50)
			print "󰁾"
		else if ($0 >= 40)
			print "󰁽"
		else if ($0 >= 30)
			print "󰁼"
		else if ($0 >= 20)
			print "󰁻"
		else if ($0 >= 10)
			print "󰁺"
		else
			print "󰂎"
	}' /sys/class/power_supply/BAT1/capacity \
	| jo