dotfilesClean dotfiles |
git clone git://git.dimitrijedobrota.com/dotfiles.git |
Log | Files | Refs |
bash_functions (470B)
0 # 1 # ${XDG_CONFIG_HOME}/bash/bash_functions 2 # 3 4 battery_status(){ 5 BATTERY=/sys/class/power_supply/BAT0 6 CHARGE=$(cat ${BATTERY}/capacity) 7 COLOUR="$RED" 8 9 [ "$CHARGE" -gt "99" ] && CHARGE=100 10 [ "$CHARGE" -gt "15" ] && COLOUR=$YELLOW 11 [ "$CHARGE" -gt "30" ] && COLOUR=$GREEN 12 13 echo -e "${COLOUR}${CHARGE}%$NORMAL" 14 } 15 16 export NORMAL="\[\e[0m\]" 17 export BOLD="\[\e[1m\]" 18 export RED="\[\e[1;31m\]" 19 export GREEN="\[\e[1;32m\]" 20 export YELLOW="\[\e[1;33m\]"