Skip to content

Add battery prompt for Windows#2726

Open
GowayLee wants to merge 7 commits intoromkatv:masterfrom
GowayLee:battery-prompt-for-windows
Open

Add battery prompt for Windows#2726
GowayLee wants to merge 7 commits intoromkatv:masterfrom
GowayLee:battery-prompt-for-windows

Conversation

@GowayLee
Copy link
Copy Markdown

@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
Copy Markdown

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
Copy Markdown
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