Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add battery prompt for Windows #2726

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

GowayLee
Copy link

@GowayLee GowayLee commented Jul 10, 2024

Thanks for your contribution and effort on p10k!
I use zsh and p10k based on GitBash in Windows, and I find that Battery Prompt is invalid for Windows.
It seems that there does not have a case for Windows to call _p9k_prompt_battery_set_args(). So, I add one for Windows, which uses wmic command to get battery info in Windows. Beside, I add a logic of checking the availability of wmic in current Windows system in _p9k_prompt_battery_init() .
After modification, this feature can work well on Windows.
I realize the Battery Prompt may not be seen as necessary on Windows, but I would like to propose that improving it could make a positive impact on the feature's completeness.
Hope you can consider merging.

@GowayLee GowayLee changed the title Add battery prompt for Wndows Add battery prompt for Windows Jul 10, 2024
@z0rc
Copy link

z0rc commented Jul 11, 2024

Powerlevel10k must be fast in all cases, in order to archive usage of external binaries is heavily constrained.

This means there should be no calls to grep, awk, no forks and subshells $() in general. Check surrounding code how parsing is implemented using Zsh parameter expansion.

@GowayLee
Copy link
Author

Thanks for pointing out the problem.
I have changed the parsing logic and avoid using grep , awk .
Please check again, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants