I’ve been using powerlevel9k
with zsh since many years now on my Mac Book. But since few days that I bought a new Mac Book Pro Ventura 13.3.1
, and reinstalled powerlevel9k and oh-my-zsh
the same way I used to, it seems like something is missing.
In fact everything is working except for zsh icons, I can see my themes and set them even in my profile. I’ve a .zshrc
file where my prompt is configured.
The problem is that all my powerlevel9k
icons are displayed but I have functions for battery status and internet connection status and zsh icons
set there are not showing.
Here is my .zshrc
configuration :
1 # Please only use this battery segment if you have material icons in your nerd font (or font)
2 # Otherwise, use the font awesome one in "User Segments"
3 # Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
4 export ZSH="$HOME/.oh-my-zsh"
5 export PATH="$PATH:$HOME/.rvm/bin"
6 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
7
8 prompt_zsh_battery_level() {
9 local percentage1=`pmset -g ps | sed -n 's/.*[[:blank:]]+*(.*%).*/1/p'`
10 local percentage=`echo "${percentage1//%}"`
11 local color="%F{red}"
12 local symbol="uf00d"
13 pmset -g ps | grep "discharging" > /dev/null
14 if [ $? -eq 0 ]; then
15 local charging="false";
16 else
17 local charging="true";
18 fi
19 if [ $percentage -le 20 ]
20 then symbol="uf579" ; color="%F{red}" ;
21 #10%
22 elif [ $percentage -gt 19 ] && [ $percentage -le 30 ]
23 then symbol="uf57a" ; color="%F{red}" ;
24 #20%
25 elif [ $percentage -gt 29 ] && [ $percentage -le 40 ]
26 then symbol="uf57b" ; color="%F{yellow}" ;
27 #35%
28 elif [ $percentage -gt 39 ] && [ $percentage -le 50 ]
29 then symbol="uf57c" ; color="%F{yellow}" ;
30 #45%
31 elif [ $percentage -gt 49 ] && [ $percentage -le 60 ]
32 then symbol="uf57d" ; color="%F{blue}" ;
33 #55%
34 elif [ $percentage -gt 59 ] && [ $percentage -le 70 ]
35 then symbol="uf57e" ; color="%F{blue}" ;
36 #65%
37 elif [ $percentage -gt 69 ] && [ $percentage -le 80 ]
38 then symbol="uf57f" ; color="%F{blue}" ;
39 #75%
40 elif [ $percentage -gt 79 ] && [ $percentage -le 90 ]
41 then symbol="uf580" ; color="%F{blue}" ;
42 #85%
43 elif [ $percentage -gt 89 ] && [ $percentage -le 99 ]
44 then symbol="uf581" ; color="%F{blue}" ;
45 #85%
46 elif [ $percentage -gt 98 ]
47 then symbol="uf578" ; color="%F{green}" ;
48 #100%
49 fi
50 if [ $charging = "true" ];
51 then color="%F{green}"; if [ $percentage -gt 98 ]; then symbol="uf584"; fi
52 fi
53 echo -n "%{$color%}$symbol" ;
54 }
55
56 zsh_internet_signal(){
57 local color
58 local symbol="uf7ba"
59 #local symbol="uf1eb"
60 if ifconfig en0 | grep inactive &> /dev/null; then
61 color="%F{red}"
62 else
63 color="%F{green}"
64 fi
65 echo -n "%{$color%}$symbol "
66 }
67
68 POWERLEVEL9K_MODE='nerdfont-complete'
69 ZSH_THEME="powerlevel9k/powerlevel9k"
70 POWERLEVEL9K_PROMPT_ON_NEWLINE=true
71 POWERLEVEL9K_PROMPT_ADD_NEWLINE=true
72 POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
73 POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
74 POWERLEVEL9K_SHORTEN_STRATEGY="truncate_beginning"
74 POWERLEVEL9K_SHORTEN_STRATEGY="truncate_beginning"
75 POWERLEVEL9K_RVM_BACKGROUND="black"
76 POWERLEVEL9K_RVM_FOREGROUND="249"
77 POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_COLOR="red"
78 POWERLEVEL9K_TIME_BACKGROUND="black"
79 POWERLEVEL9K_TIME_FOREGROUND="249"
80 POWERLEVEL9K_TIME_FORMAT="UF43A %D{%H:%M UF133 %m.%d.%y}"
81 POWERLEVEL9K_RVM_BACKGROUND="black"
82 POWERLEVEL9K_RVM_FOREGROUND="249"
83 POWERLEVEL9K_RVM_VISUAL_IDENTIFIER_COLOR="red"
84 POWERLEVEL9K_STATUS_VERBOSE=false
85 POWERLEVEL9K_VCS_CLEAN_FOREGROUND='black'
86 POWERLEVEL9K_VCS_CLEAN_BACKGROUND='green'
87 POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND='black'
88 POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'
89 POWERLEVEL9K_VCS_MODIFIED_FOREGROUND='white'
90 POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='black'
91 POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='black'
92 POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='blue'
93 POWERLEVEL9K_FOLDER_ICON=''
94 POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=true
95 POWERLEVEL9K_STATUS_VERBOSE=false
96 POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0
97 POWERLEVEL9K_VCS_UNTRACKED_ICON='u25CF'
98 POWERLEVEL9K_VCS_UNSTAGED_ICON='u00b1'
99 POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='u2193'
100 POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='u2191'
101 POWERLEVEL9K_VCS_COMMIT_ICON="uf417"
102 POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}u256Du2500%f"
103 POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}u2570uf460%f "
104 POWERLEVEL9K_CUSTOM_BATTERY_STATUS="prompt_zsh_battery_level"
105 POWERLEVEL9K_CUSTOM_BATTERY_STATUS_BACKGROUND="grey"
106 POWERLEVEL9K_CUSTOM_INTERNET_SIGNAL="zsh_internet_signal"
107 POWERLEVEL9K_CUSTOM_INTERNET_SIGNAL_BACKGROUND="grey"
108 POWERLEVEL9K_CUSTOM_CRAFTSMAN="echo -n $'uf98c' ArchitectCraftsmanShip"
109 POWERLEVEL9K_CUSTOM_CRAFTSMAN_FOREGROUND="white"
110 POWERLEVEL9K_CUSTOM_CRAFTSMAN_BACKGROUND="darkgreen"
111 POWERLEVEL9K_CUSTOM_PROGRAMING="echo -n $'ue606'"
112 POWERLEVEL9K_CUSTOM_PROGRAMING_FOREGROUND="black"
113 POWERLEVEL9K_CUSTOM_PROGRAMING_BACKGROUND="white"
114 POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context os_icon custom_internet_signal custom_battery_status_joined custom_craftsman custom_programing ssh root_indicator dir dir_writable vcs)
115 POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(command_execution_time status time)
116 HIST_STAMPS="mm/dd/yyyy"
117 DISABLE_UPDATE_PROMPT=true
118 #source ~/powerlevel9k/powerlevel9k.zsh-theme
119 source /Users/engontang/homebrew/opt/powerlevel9k/powerlevel9k.zsh-theme
120 #source $ZSH/oh-my-zsh.sh
121 source $(dirname $(gem which colorls))/tab_complete.sh
122 alias ll="colorls -lA --sd --gs"
123 fpath=(~/zsh-completions/src $fpath)
124 autoload -U compinit && compinit
125 alias python='python3'
126 alias mk='minikube'
127 alias kctl="kubectl"
128 #bindkey -v
129 #bindkey '^R' history-incremental-search-backward
130 # AWS ACCOUNT NAME
131 function aws_account_info {
132 [ "$AWS_ACCOUNT_NAME" ] && [ "$AWS_ACCOUNT_ROLE" ] && echo "%F{blue}aws:(%f%F{red}$AWS_ACCOUNT_NAME:$AWS_ACCOUNT_ROLE%f%F{blue})%F$reset_color"
133 }
134
135 # )ofni_tnuocca_swa($ is $(aws_account_info) backwards
136 PROMPT=`echo $PROMPT | rev | sed 's/ / )ofni_tnuocca_swa($ /'| rev`
137
138 export DEBUG_ASSUME_ROLE="true" # turns on debugging
139 export ACCOUNTS_FILE="/Users/eugene.ngontang/.aws/accounts"
140 export SAML_FILE="/Users/eugene.ngontang//.aws/saml_creds"
141 export SAML_IDP_ASSERTION_URL="https://sts.compass-group.fr"
142 export SAML_IDP_REQUEST_BODY_TEMPLATE="{"service": "aws", "email": "engontang@compass-group.fr", "password": ""}"
143 export AWS_ROLE_SESSION_TIMEOUT=43200
144 export AWS_DEFAULT_REGION="eu-central-1"
As you can see, prompt_zsh_battery_level
and zsh_internet_signal
are functions for battery and network status in my command line prompt. They show right status color but show question marks ?
for icons, like this:
I searched everywhere, but didn’t find how to fix this issue, which didn’t exist in my previous Mac Book setups. I can’t figure out what is missing.
Any help?