#!/usr/bin/env bash capacity=$(cat /sys/class/power_supply/BAT0/capacity) || break status=$(cat /sys/class/power_supply/BAT0/status) time_left=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time" | sed 's/.*://' | xargs echo $1) if [[ $status == "Charging" ]] then status="" else if [[ $capacity -ge 75 ]] then status="" elif [[ $capacity -ge 50 ]] then status="" elif [[ $capacity -ge 25 ]] then status="" elif [[ $capacity -ge 10 ]] then status="" else status="" fi fi echo "$status $capacity% $time_left"