dotfiles

Clean dotfiles
git clone git://git.dimitrijedobrota.com/dotfiles.git
Log | Files | Refs

bash_functions (470B)


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