Skip to content

Instantly share code, notes, and snippets.

@thrashr888
Created September 23, 2017 23:38
Show Gist options
  • Save thrashr888/1e20284a230110a9cb30f926a39cc0d7 to your computer and use it in GitHub Desktop.
Save thrashr888/1e20284a230110a9cb30f926a39cc0d7 to your computer and use it in GitHub Desktop.
function cpu_load() {
ps -A -o %cpu | awk '{s+=$1} END {print s "%"}'
}
function battery_load() {
pmset -g batt | grep -o '[0-9]*%' | tr -d %
}
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;32m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[01;37m\]\u\[\033[01;36m\] \[\033[01;33m\]\t \[\033[01;37m\]($(cpu_load)) [\[\033[01;33m\]$(battery_load)⚡\[\033[01;37m\]] \[\033[01;36m\]\W\[\033[35m\]$(__git_ps1 " %s") \[\033[01;37m\]⚡\[\033[00m\] '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment