sb

shitty bar for dwm
git clone git://git.ckyln.com/~cem/sb.git
Log | Files | Refs | README | LICENSE

sb_battery (372B)


      1 # Gets the battery state and capacity
      2 # prints to stdout
      3 battery() {
      4     read -r stat < "/sys/class/power_supply/${BATTERY:=BAT0}/status"
      5     read -r cap < "/sys/class/power_supply/$BATTERY/capacity"
      6     [ "$cap" -lt 25 ] && [ "$COLORBAR" ] && printf '\x04 '
      7     printf '%s%% [%s] %s ' "$cap" "$stat" "${COLORBAR+$(printf '\x01')}$DELIMITER"
      8 }
      9 xsetroot -name "$(battery)"