Skip to content

Commit

Permalink
remove battery check from prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
mediocretes committed Jan 10, 2014
1 parent 6e6bd5b commit 31a186c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ cf_prompt_command() {
[[ "$CF_RUNNING_VERSION" != "$CF_LOCAL_LATEST_VERSION" ]] && exec bash
# cf_long_running_task_check
[[ "`declare -f cf_user_prompt_hook`" != "" ]] && cf_user_prompt_hook
BATTERY_PERCENT="$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}')"
# the following line has gotten incredibly slow, but I'm not ready to give up on the concept, so I'm commenting. Deal with it.
# BATTERY_PERCENT="$(ioreg -l | grep -i capacity | tr '\n' ' | ' | awk '{printf("%.2f%%", $10/$5 * 100)}')"
BATTERY_PERCENT=66
let BATTERY="$(echo -n ${BATTERY_PERCENT} | sed 's/\...%//')"
#does your computer report 99.5% instead of 100%? You might find the following more useful than sed rounding.
#let BATTERY="$(echo -n ${BATTERY_PERCENT} | sed 's/[^0-9]//g')"
Expand Down

2 comments on commit 31a186c

@jqr
Copy link

@jqr jqr commented on 31a186c Jan 10, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance you can just cache this somewhere and throttle regeneration to 1/min?

@mediocretes
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is definitely my plan, assuming there isn't some new official way to get that data, but today, I just need faster prompt.

Please sign in to comment.