[zshrc] switch from spaces to tabs
This commit is contained in:
parent
c9ae405e10
commit
749a5e97b3
|
@ -28,36 +28,36 @@ alias batt="upower -i /org/freedesktop/UPower/devices/battery_BAT0|grep percenta
|
||||||
## Battery status (overwrites upstream function!)
|
## Battery status (overwrites upstream function!)
|
||||||
|
|
||||||
function batterylinux () {
|
function batterylinux () {
|
||||||
GRML_BATTERY_LEVEL=''
|
GRML_BATTERY_LEVEL=''
|
||||||
local batteries bat capacity
|
local batteries bat capacity
|
||||||
batteries=( /sys/class/power_supply/BAT*(N) )
|
batteries=( /sys/class/power_supply/BAT*(N) )
|
||||||
if (( $#batteries > 0 )) ; then
|
if (( $#batteries > 0 )) ; then
|
||||||
for bat in $batteries ; do
|
for bat in $batteries ; do
|
||||||
if [[ -e $bat/capacity ]]; then
|
if [[ -e $bat/capacity ]]; then
|
||||||
capacity=$(< $bat/capacity)
|
capacity=$(< $bat/capacity)
|
||||||
else
|
else
|
||||||
typeset -F energy_full=$(< $bat/energy_full)
|
typeset -F energy_full=$(< $bat/energy_full)
|
||||||
typeset -F energy_now=$(< $bat/energy_now)
|
typeset -F energy_now=$(< $bat/energy_now)
|
||||||
typeset -i capacity=$(( 100 * $energy_now / $energy_full))
|
typeset -i capacity=$(( 100 * $energy_now / $energy_full))
|
||||||
fi
|
fi
|
||||||
case $(< $bat/status) in
|
case $(< $bat/status) in
|
||||||
Charging)
|
Charging)
|
||||||
GRML_BATTERY_LEVEL+="%F{blue}^%f"
|
GRML_BATTERY_LEVEL+="%F{blue}^%f"
|
||||||
;;
|
;;
|
||||||
Discharging)
|
Discharging)
|
||||||
if (( capacity < 20 )) ; then
|
if (( capacity < 20 )) ; then
|
||||||
GRML_BATTERY_LEVEL+="%F{red}!v%f"
|
GRML_BATTERY_LEVEL+="%F{red}!v%f"
|
||||||
else
|
else
|
||||||
GRML_BATTERY_LEVEL+="%F{yellow}v%f"
|
GRML_BATTERY_LEVEL+="%F{yellow}v%f"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) # Full, Unknown
|
*) # Full, Unknown
|
||||||
GRML_BATTERY_LEVEL+="%F{green}=%f"
|
GRML_BATTERY_LEVEL+="%F{green}=%f"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
GRML_BATTERY_LEVEL+="${capacity}%%"
|
GRML_BATTERY_LEVEL+="${capacity}%%"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue