Battery indicator displaying regardless of % and device connected to power.
Provide a screenshot that show your issue

Operating system: macOS Sierra 10.12.6
Terminal emulator: iTerm 3.0.15
ZSH version: zsh 5.4.1 (x86_64-apple-darwin16.7.0)
.zshrc# Set Antigen theme
antigen theme https://github.com/denysdovhan/spaceship-zsh-theme spaceship
No additional configuration
Complete battery output from setopt xtrace verbose
+spaceship_prompt:15> section=battery
+spaceship_prompt:16> spaceship_battery
+spaceship_battery:1> [[ true == false ]]
+spaceship_battery:3> local battery_data battery_percent battery_status battery_color
+spaceship_battery:5> _exists pmset
+_exists:1> command -v pmset
+spaceship_battery:6> battery_data=+spaceship_battery:6> pmset -g batt
+spaceship_battery:6> battery_data=$'Now drawing from \'AC Power\'\n -InternalBattery-0 (id=3407971)\t100%; charged; 0:00 remaining present: true'
+spaceship_battery:9> [[+spaceship_battery:9> echo $'Now drawing from \'AC Power\'\n -InternalBattery-0 (id=3407971)\t100%; charged; 0:00 remaining present: true'
+spaceship_battery:9> [[+spaceship_battery:9> grep '--color=auto' '--exclude-dir=.bzr' '--exclude-dir=CVS' '--exclude-dir=.git' '--exclude-dir=.hg' '--exclude-dir=.svn' InternalBattery
+spaceship_battery:9> [[ -z $' -InternalBattery-0 (id=3407971)\t100%; charged; 0:00 remaining present: true' ]]
+spaceship_battery:11> battery_percent=+spaceship_battery:11> echo $'Now drawing from \'AC Power\'\n -InternalBattery-0 (id=3407971)\t100%; charged; 0:00 remaining present: true'
+spaceship_battery:11> battery_percent=+spaceship_battery:11> grep '--color=auto' '--exclude-dir=.bzr' '--exclude-dir=CVS' '--exclude-dir=.git' '--exclude-dir=.hg' '--exclude-dir=.svn' -oE '[0-9]{1,3}%'
+spaceship_battery:11> battery_percent=100%
+spaceship_battery:12> battery_status=+spaceship_battery:12> echo $'Now drawing from \'AC Power\'\n -InternalBattery-0 (id=3407971)\t100%; charged; 0:00 remaining present: true'
+spaceship_battery:12> battery_status=+spaceship_battery:12> awk -F '; *' 'NR==2 { print $2 }'
+spaceship_battery:12> battery_status=charged
+spaceship_battery:32> battery_percent=+spaceship_battery:32> echo 100%
+spaceship_battery:32> battery_percent=+spaceship_battery:32> tr -d '%[,;]'
+spaceship_battery:32> battery_percent=100
+spaceship_battery:35> [[ 100 == 100 ]]
+spaceship_battery:36> battery_color=green
+spaceship_battery:44> [[ charged == charging ]]
+spaceship_battery:46> [[ $battery_status -regex-match "^[dD]ischarg.*" ]]
+spaceship_battery:49> battery_symbol=•
+spaceship_battery:53> [[ false == true || 100 -lt 10 || $battery_status -regex-match "(charged|full)" ]]
+spaceship_battery:54> _prompt_section green '' •100%% ' '
Thank you @dwhoban for the detailed report. But from provided information, battery section is behaving as expected ( displaying section when completely charged ).
Could you provide info about when it's not behaving as expected ?
@salmanulfarzy I have never had the battery displayed before, and I couldn't see where in the changelog when the change had been released.
It would be good to be able to set it only to show if below the threshold and be able to turn off the fully charged view
Battery section was added with v2.9.0. Default behavior is to display battery section only if it's below threshold (default: 10%) or fully charged.
A typo was fixed in #201, It'll be available with the next release. Also see related PR #164
able to turn off the fully charged view
We could add an option for that. What do you think about variable name ?
Sorry got swamped with a project - I would make it simple like BATTERY_CHARGED_SHOW with a true/false flag.
If anyone is looking for a quick fix to turn of the 100% behavior, it's on line 1089. Remove the OR statement that says || $battery_status =~ "(charged|full)" and you should see the battery percentage only show up when it's below the set threshold.
This now possible with #306 🎉
| SPACESHIP_BATTERY_SHOW | Below threshold | Above threshold | Fully charged |
| :----------------------: | :-------------- | :-------------- | :------------ |
| false | Hidden | Hidden | Hidden |
| always | Shown | Shown | Shown |
| true | Shown | Hidden | Hidden |
| charged | Shown | Hidden | Shown |
Most helpful comment
@salmanulfarzy I have never had the battery displayed before, and I couldn't see where in the changelog when the change had been released.
It would be good to be able to set it only to show if below the threshold and be able to turn off the fully charged view