battchrg.sh
I am using Terminal iTerm2 regularly, on fullscreen. So whenever I want to check the remaining battery level, I have to put my fingers on the touchpad, away from the cozy home row (hjkl), swipe up, wait a couple of milliseconds, read the battery and then, back to work.
This is not comfortable at all. And, obviously, I should always keep in mind to check the battery level this way. So anyway, there’s a simple solution: let’s show the remaining percentage in my prompt. It’s no big deal, many people have already done it.
What they didn’t do is, showing this information with the least space required. Let’s say, one character for this purpose. It’s doable.
My script only shows the tenths of the remaining percentage and its color depends on the ones, with the accuracy of +/- 2%. That’s pretty good for me.
So here’s my script:
https://github.com/Xronophobe/battchrg Unfortunately, it messes up long rows when I add this script into my prompt so it’s not ready just yet. Otherwise, works as expected.
Probably it’s the colors what causes the problem so my next task is to rewrite the coloring part. Coming soon.














