blob: 78fb773eb209198348d8427c4499be4ba6c167d4 (
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
|
#!/usr/bin/env bash
i3status -c $HOME/.config/i3blocks/i3status.conf | while IFS= read -r line; do
PARTS=($line)
CHARGE="${PARTS[1]}"
CHARGE="${CHARGE%\%*}"
[[ "${CHARGE}" -gt 100 ]] && {
CHARGE="100"
}
STATE=""
[[ "${PARTS[0]}" = "BAT" ]] && {
STATE="${PARTS[2]}"
[[ -n "${STATE}" ]] && {
STATE="${STATE:0:-3}"
STATE=" (${STATE})"
}
}
LEVEL=$(( (CHARGE - 1) / 20 ))
ICON="f$(( 244 - LEVEL ))"
echo -e "\u${ICON} ${CHARGE}%${STATE} "
[[ "${LEVEL}" = "0" ]] && {
[[ -z "${STATE}" ]] || i3-msg "fullscreen disable" >/dev/null
}
done
|