Cobalt2-iterm
Cobalt2-iterm copied to clipboard
Purpose of the white cross at the beginning of the prompt
What is the purpose of the white cross with the black background at the beginning of the prompt?

It doesn't seem to change at all. Can I change it to an emoji or something else?
Wes probably just wanted to use it as a symbol, it's an emoji that you can change yourself. It's on the end of this line 🙂
https://github.com/wesbos/Cobalt2-iterm/blob/master/cobalt2.zsh-theme#L52
Okay, it's been awhile, but stumbled across this will updating my dotfiles. The cross appears when you are ssh to a different users on the same machine, or when you ssh into a different machine that also has the cobalt2 setup.
I'm using Terminal on macOS, and I used https://github.com/jabranr/cobalt2-like to setup the cobalt2 theme in Terminal. The instructions there have us do your installation first, then some additional steps. When I open a Terminal window, I get the cross at the start of the prompt. $DEFAULT_USER is not set nor is $SSH_CLIENT. I have seen some examples where there is a home icon or folder icon at the start of the prompt depending on what directory you are in. Any suggestions for getting that setup?
Somewhere, someone suggested doing this:
You could write a function like this, replacing 'home' and 'not home' with your icons
zsh_prompt_home_indicator() {
if [[ "$PWD" = "$HOME" ]];then
echo "home"
else
echo "not home"
fi
}
then add $(zsh_prompt_home_indicator) to your PROMPT where you want the icons to appear.
I tried the following in ~/.oh_my_zsh/themes/cobalt2.zsh-theme:
...
...
prompt_context() {
local user=`whoami`
#if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
if [[ -n "$SSH_CLIENT" ]]; then <====CHANGED
prompt_segment black default "%(!.%{%F{yellow}%}.)✝"
else <=============ADDED
prompt_segment blue default "%(!.%{%F{yellow}%}.)" <==========ADDED
fi
}
...
...
##### I added this: ######
zsh_prompt_home_indicator() {
if [[ "$PWD" = "$HOME" ]];then
echo 🏡
else
echo 📂
fi
}
###################
PROMPT='%{%f%b%k%}$(zsh_prompt_home_indicator)$(build_prompt) '
That "works" somewhat: the icons are displayed correctly at the start of the prompt, but they are not on a blue background. As a test, I used the cross character in the else branch of prompt_context(), and I deleted $(zsh_prompt_home_indicator) from the PROMPT= line, and the cross does appear on the blue background. I surmise that the icons I'm using take up the whole area allotted for the character or don't have a transparent background. Where do the icons, like on this guys cobalt2 themed prompt, come from: https://youtu.be/8JJ101D3knE?si=kSk1_kaJG2bUON_K&t=820