-
Notifications
You must be signed in to change notification settings - Fork 338
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
powerlevel10k support #2851
Comments
+1 This would be amazing. I would love to help too. (in whatever way I can) |
Hi @romkatv Thanks so much for submitting this and your offer to help make Powerlevel10K work with Warp! Please add a :+1: to the original post at the top to signal that you want this feature, and hit the subscribe button if you'd like to be notified. |
Thanks @romkatv for helping, i'd love to have powerlevel10k working with warp asap!! 💪 |
Any news from this? 🤔 |
Closing as there doesn't seem to be any interest from the devs. |
@romkatv Hey! We're definitely interested, and would love to work with you to get p10k working well within Warp. I'm so sorry that we haven't been more proactive about reaching out; we were trying to collect institutional knowledge about the issues we uncovered when investigating the p10k compatibility problem a long time ago, and then the person who was going to reach out went OOO. Give me a couple days to build an up-to-date understanding of the specific issues that appear when trying to use Warp with p10k and I'll reply with them here. In the meantime, can you link me to the part of the p10k codebase that adds the annotations you were mentioning? I can mentally map that onto what would make sense for Warp and be better able to make a suggestion about a path forward. Again, really sorry that we dropped the ball here. |
No worries, I understand that things can be hectic in a fast-moving project. If you search for "_POWERLEVEL9K_TERM_SHELL_INTEGRATION" within p10k.zsh, you'll find most of the shell integration code. This code is nearly impenetrable, which is why I offered to make changes to it myself. Powerlevel10k has a few capabilities that might prove challenging to handle. Let me summarize them. Prompt may change when you press ENTERHere's an example where a multi-line prompt changes to a single-character prompt on ENTER. Here prompt is contracted on ENTER but it can also expand. For example, some users like to have timestamps on past prompt commands without having the timestamp on the current prompt. In this case a timestamp is added to prompt when you press ENTER. Prompt may change in response to what you are typingHere's an example where prompt shows Google Cloud credentials and Kubernetes context when the command you are typing invokes Prompt may change on its own accordSome prompt segments can update asynchronously. In practice this means that prompt may change on its own without any user action. This can lead both to contraction and expansion. In the extreme, even the height of prompt may change. Prompt may change when the terminal window is resizedYou most likely can already handle this because it's not unusual for zsh prompt to change on resize but I want to mention it for completeness. Here's an example (see the end of the recording): Powerlevel10k may print a fake first prompt before zsh is initializedThis feature is meant to hide zsh initialization latency: instead of looking at an empty screen for some time after starting zsh, the user is instantly presented with a prompt and can start typing. When zsh is fully initialized, the fake prompt is replaced with the real thing. In this example the real prompt looks the same as the fake prompt but it can also be different. For example, if the current directory is under a git repository, the fake prompt won't have git status but the real prompt will. More info about this feature: https://github.com/romkatv/zsh-bench#instant-prompt |
Hey @romkatv, one question for you while I work out a more complete technical design on our end: I see that the escape sequence |
I can embed any escape sequence in any place within powerlevel10k prompt you like. |
Fantastic. In my prototype (where I modified Any immediate thoughts as to what might be going on? Here's the small adjustment I made: if (( _POWERLEVEL9K_TERM_SHELL_INTEGRATION )); then
_p9k_prompt_prefix_left+=$'%{\e]133;A\a%}'
_p9k_prompt_suffix_left+=$'%{\e]133;B\a%}'
+ _p9k_prompt_prefix_right+=$'%{\e]133;C\a%}'
+ _p9k_prompt_suffix_right+=$'%{\e]133;D\a%}' |
If you tell me how you want prompt to be marked, I'll make the changes. |
Sure; I can keep working on the necessary changes for broad functionality on our end and assume that the changes you make will address any small oddities I encounter. I'll leave a more detailed comment either tomorrow or Monday with the set of changes that we'll need on the p10k end to address compatibility issues! |
It's really awesome to see how this thread made a 180° turn and see your collaboration and communication. Thank you for working on this to you both |
I believe this might be unrelated to P10k but rather Warp's line height implementation which does not seem centered. Not for the NerdFont Icons at least. Using Starship, and the same Nerd Font icons I can achieve a P10k'esk look but it suffers from the exact same artifacts. The most interesting part which I'd like to highlight, is that the alignment is different from box to box. Regardless of box content. Hope this helps. |
@pXius I believe "odd artifacts in the right-side prompt" was referring to "%b". P.S. The only way other terminals manage to render powerline glyphs (and sometimes UNICODE block characters) perfectly is by special-casing them in the rendered. You can notice that a terminal does this if it can display things like U+E0B0 even if there is no glyph for it in the font. |
@pXius Yeah, the glyph alignment issues are largely a problem with the font, though there are also appear to be some small floating-point rounding(?) issues on our end, as you observed with the inconsistent vertical alignment from block to block. We'll eventually use the same trick as other terminals to get perfect rendering of these characters, but it's not super high on our priority list at the moment. I figured out the %b bit; finishing up some prototyping/analysis and will return later today with details of what (I expect small) changes will be needed for proper Warp support! |
Hey @romkatv - trying to debug one last possible integration issue: it seems like the updated prompts produced in response to changes in the input buffer (the functionality described here) don't currently include the start and end prompt markers that are sent for iTerm's shell integration; is that accurate? Want to make sure that the behavior I'm seeing is due to a lack of markers, and not some more significant logic error/compatibility issue on our end (we have a feature that I'm trying to make sure plays nicely with this p10k functionality). |
powerlevel10k should write the markers every time it prints (or re-prints) prompt. There might be a bug that prevents this from happening but it's very unlikely. |
Hey @romkatv - here's what we've come up with: We'd like to prefix the right-side prompt with the sequence In terms of detecting when Warp is the active terminal, we set For now, at least, we'll override Finally, we'd like to be able to detect when a user has loaded an older version of p10k (one that doesn't contain the changes above) so we can prompt the user to update p10k for a better user experience. (We'll direct users to the update instructions on the p10k GitHub page.) Is there any way for us to perform a version check via shell variables, or should we just check the If you'd like, you can send me a link to a branch with the relevant changes and I can test it out with my Warp-side changes to make sure everything works as expected before you merge it into your master branch. |
Ack. This all sounds great to me. I'll go over your comment with greater attention and make necessary changes in p10k early next week. Will ping here. |
I'm a user of Powerlevel10k coming from iTerm2 and wanting to be able to use it migrating to Warp. Thanks for working on it, I'm excited to use it. |
I've opened romkatv/powerlevel10k#2307 to track the development on Powerlevel10k side and made two changes within https://github.com/romkatv/powerlevel10k/tree/warp:
Please check whether the changes work for you. I don't have Warp installed, so I'm relying on your testing here. You can use the following logic to detect Warp support within Powerlevel10k: if (( ${+functions[p10k]} )); then
if [[ ${_p9k__param_pat-} == v<1-149>$'\1'* ]]; then
print 'Powerlevel10k predates Warp integration'
else
print 'Powerlevel10k has Warp integration'
fi
else
print 'Powerlevel10k not found'
fi Note that |
Generally looks good! I've got rendering working nicely (with some flicker prevention for transient prompts). I still need to add the logic to perform version checks, so not quite ready yet to LGTM your |
@dehan-jl Nice one, thanks mate |
For me the problem is I don't see the features enabled until I run |
@pmbanugo have you turned on |
This worked perfect, thanks! I didn't need to change the startup shell because my default is zsh. |
@chandrakanthkannam I think they have moved the setting. Go to Settings > Appearance > Prompt & make sure that Shell prompt (PS1) is selected. |
Thanks @Scott-J-McMullan , I was able to get that running now. |
Besides dong |
Hi Everyone, I didnt found any variable config to configure it in p10k.zsh file. Someone maybe familiar with such issue ? Thanks. |
@kzana Probably #2851 (comment) |
Thanks I missed it ! |
Hello, EDIT |
Gonna close this out since it's mostly working. We can open up new issues for follow up improvements. |
Thank you! :D |
I solved the problem by adding if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS+=(newline)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(newline)
fi to the bottom of |
For my case, I needed to remove Prompt and a new line, so I did this in my [[ ! -f ~/.p10k.zsh ]] || {
source ~/.p10k.zsh
if [[ $TERM_PROGRAM == "WarpTerminal" ]]; then
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(${POWERLEVEL9K_LEFT_PROMPT_ELEMENTS[1,-3]})
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(${POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS[1,-2]})
fi
} |
It looks like you've enabled Transient Prompt. You can turn it off via the configuration wizard or by editing |
Thanks! Thought there would be something to disable it completely, but this looks good as well. ![]() |
@aboqasem If you can describe what you want to achieve, I may be able to help you get there. The best venue for this discussion would be https://github.com/romkatv/powerlevel10k/issues. |
Any solution to make this work? It even works, but only after the command has been executed. For example, seeing the current openshift/kubernetes context is useful before running oc/kubectl CLI.
|
Did you try and see this above your comment? It just resolved your same issue for me: #2851 (comment) |
I'm the author and maintainer of powerlevel10k (a zsh theme). I see in the docs that Warp does not support powerlevel10k. Is there anything I can help you with?
I haven't used Warp but from other terminals with similar capabilities I gather that you need to annotate prompt and the command line with special escape codes. Powerlevel10k has built-in support for popular annotations. The right kind of annotation is enabled automatically based on the terminal (iTerm2, Kitty, VSCode, etc.). I could do the same for Warp but I would need to know what needs annotating. Perhaps you have a specification of the protocol?
Warp Internal (ignore) - linear-label:770f6576-d6c0-4e4f-a259-fc64b5156087
The text was updated successfully, but these errors were encountered: