summaryrefslogtreecommitdiff
path: root/.config/i3blocks/i3_battery.sh
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-12-08 11:52:16 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-12-08 11:52:16 +0100
commit956df69d7496081db5e7b3621a0bcc7b9d7f7dfc (patch)
tree2c1de01541d70d1cbcb59974e42102440359f153 /.config/i3blocks/i3_battery.sh
parent1eca5dc0fe3648341e1707efc811162fc5056888 (diff)
move to .config folder
Diffstat (limited to '.config/i3blocks/i3_battery.sh')
-rwxr-xr-x.config/i3blocks/i3_battery.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/.config/i3blocks/i3_battery.sh b/.config/i3blocks/i3_battery.sh
new file mode 100755
index 0000000..97ea493
--- /dev/null
+++ b/.config/i3blocks/i3_battery.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+BAT=$(acpi -b | grep -E -o '[0-9][0-9]?%')
+CHECK_CHARGING=$(acpi -b | grep -E -o 'Charging')
+
+# Full and short texts
+echo "Battery: $BAT"
+echo "BAT: $BAT"
+
+if [ "$CHECK_CHARGING" != "" ]; then
+ echo "#1abc9c"
+ exit 0
+fi
+# Set urgent flag below 5% or use orange below 20%
+[ ${BAT%?} -le 5 ] && exit 33
+[ ${BAT%?} -le 35 ] && echo "#d35400"
+
+exit 0