romkatv / powerlevel10k

A Zsh theme
MIT License
44.23k stars 2.11k forks source link

P9K_SSH not set when SSH into WSL #2709

Open JosefUtbult opened 1 week ago

JosefUtbult commented 1 week ago

Hi. I was working with a Windows machine that I accessed over SSH, and I realized that the hostname wasn't showing up in the commandline as it should. This seems to be caused by the P9K_SSH flag not being set to 1 for SSH in WSL. I did a quickfix in my zshrc file that looks like this

if [[ "$(cmd.exe /c 'echo %SSH_CLIENT%' 2>/dev/null | sed $'s/\r//' | grep ' 22$')" ]]; then
  export P9K_SSH=1
fi

It pretty much runs cmd and checks if the SSH_CLIENT flag is set for Windows, and if that is the case just sets P9K_SSH manually.

I couldn't figure out where that flag is set by P10K, otherwise I would have solved it and made a pull request. Hope this was at least a bit relevant

JosefUtbult commented 1 week ago

I seem to have figured it out