update zsh config

This commit is contained in:
Simon Bruder 2018-03-14 13:53:15 +00:00
parent 6608857688
commit 72fc8b93e7
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F
3 changed files with 559 additions and 303 deletions

File diff suppressed because it is too large Load diff

View file

@ -30,6 +30,42 @@ PATH="$PATH:$HOME/bin"
## Battery percentage
alias batt="upower -i /org/freedesktop/UPower/devices/battery_BAT0|grep percentage|awk '{print $2}'"
## Battery status (overwrites upstream function!)
function batterylinux () {
GRML_BATTERY_LEVEL=''
local batteries bat capacity
batteries=( /sys/class/power_supply/BAT*(N) )
if (( $#batteries > 0 )) ; then
for bat in $batteries ; do
if [[ -e $bat/capacity ]]; then
capacity=$(< $bat/capacity)
else
typeset -F energy_full=$(< $bat/energy_full)
typeset -F energy_now=$(< $bat/energy_now)
typeset -i capacity=$(( 100 * $energy_now / $energy_full))
fi
case $(< $bat/status) in
Charging)
GRML_BATTERY_LEVEL+="%F{blue} ^%f"
;;
Discharging)
if (( capacity < 20 )) ; then
GRML_BATTERY_LEVEL+="%F{red} !v%f"
else
GRML_BATTERY_LEVEL+="%F{yellow} v%f"
fi
;;
*) # Full, Unknown
GRML_BATTERY_LEVEL+="%F{green} =%f"
;;
esac
GRML_BATTERY_LEVEL+="${capacity}%%"
done
fi
}
## Upload to transfer.sh
transfer() {
if [ $# -eq 0 ];then

View file

@ -2,3 +2,5 @@
source "$HOME/.homesick/repos/homeshick/homeshick.sh"
fpath=($HOME/.homesick/repos/homeshick/completions $fpath)
GRML_DISPLAY_BATTERY=1