powerlevel10k icon indicating copy to clipboard operation
powerlevel10k copied to clipboard

Add battery prompt for Windows

Open GowayLee opened this issue 1 year ago • 2 comments

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 avatar Jul 10 '24 06:07 GowayLee

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.

z0rc avatar Jul 11 '24 09:07 z0rc

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

GowayLee avatar Jul 11 '24 18:07 GowayLee