Random code snippets used in my environments (mostly i3)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
299 B

#!/bin/bash
## powers
NOW=$(cat /sys/class/power_supply/BAT0/charge_now)
FULL=$(cat /sys/class/power_supply/BAT0/charge_full)
## set echo vars
CHRG=$(\
echo "($NOW/$FULL)*100" | bc -l | cut -c1-2 \
)
STAT=$(\
cat /sys/class/power_supply/BAT0/status | \
cut -c1-4 \
)
## output
echo $STAT $CHRG