Powerlevel9k: os_icon shows os as text

Created on 11 Mar 2017  路  12Comments  路  Source: Powerlevel9k/powerlevel9k

I'm trying to display the os_icon on the prompt. However it only displays the text "OSX" instead of the Apple logo.

I'm using powerlevel9k for oh-my-zsh.
Here is the relevant info from my ~/.zshrc:

ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_MODE='awesome-patched'
POWERLEVEL9K_HOME_ICON=''
POWERLEVEL9K_HOME_SUB_ICON=''
POWERLEVEL9K_FOLDER_ICON=''
DISABLE_AUTO_TITLE="true"
POWERLEVEL9K_VCS_GIT_ICON=''
POWERLEVEL9K_VCS_STAGED_ICON='u00b1'
POWERLEVEL9K_VCS_UNTRACKED_ICON='u25CF'
POWERLEVEL9K_VCS_UNSTAGED_ICON='u00b1'
POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON='u2193'
POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON='u2191'
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND='yellow'
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND='yellow'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(status os_icon context dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(background_jobs virtualenv rbenv rvm time)
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle"
POWERLEVEL9K_SHORTEN_DIR_LENGTH=4
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M uE868 %d.%m.%y}"
POWERLEVEL9K_STATUS_VERBOSE=false
export DEFAULT_USER="$USER"

Here's how my prompt look:

screen shot 2017-03-11 at 19 59 01

What am I missing?

Most helpful comment

So, POWERLEVEL9K_MODE='awesome-patched' stands before you source oh-my-zsh, right?
If so, have you restarted zsh?

All 12 comments

So, POWERLEVEL9K_MODE='awesome-patched' stands before you source oh-my-zsh, right?
If so, have you restarted zsh?

@dritter Hm, no it did not! After I moved it above that line it works! Thank you very much!

Same problem here. @dritter By restarted zsh do you mean source ~/.zshrc?

@tanmay-das Yes, sourcing ~/.zshrc should do the trick. It is necessary to set POWERLEVEL9K_MODE before you source the theme (implicit or explicit), because we load the correct icon scheme based on that variable on load time.
If you source ~/.zshrc and the right icons do not show up, you probably have set POWERLEVEL9K_MODE too late..

If you source ~/.zshrc and the right icons do not show up, you probably have set POWERLEVEL9K_MODE too late..

@dritter What should I do in that case?

Here is my ~/.zshrc file:

export TERM="xterm-256color"
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:$PATH
export PATH=$HOME/.local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=/home/tanmay/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="powerlevel9k/powerlevel9k"

#powerlevel19k configuration

POWERLEVEL9K_MODE='awesome-fontconfig'
POWERLEVEL9K_SHORTEN_STRATEGY="truncate_to_unique"
POWERLEVEL9K_SHORTEN_DIR_LENGTH=4
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon virtualenv root_indicator dir background_jobs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status vcs time ram)

# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
  git
)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
source ~/.fonts/*.sh

@tanmay-das Your source order looks correct. I think I know what your Problem is.
May it be that you use Linux as OS? And may it be that you recently updated (or installed) Powerlevel9k?

In v0.6.5 we introduced a more fine grained distinction between different Linux variants (See #758) and only nerdfont-complete has icons for the various Distributions. So, all other icon sets use abbreviations for that. There is already a Issue for that (#936).

You of course can change the icon if you want by setting the correct variable (See get_icon_names for that).

@dritter You're correct. I am using Linux and I recently installed Powerlevel9k.

How do I get my good old tux icon back instead of the three letters without having to install nerd-fonts?

Put this in your configuration:

OS_ICON=$(print_icon 'LINUX_ICON')

or define your own:

OS_ICON='\uE271' # or '\uF17C'

@onaforeignshore Unfortunately that didn't work. It gives me command print_icon not found if I add the first statement, and nothing shows up (except three letter abbr.) if I add the second statement.

@tanmay-das Try setting POWERLEVEL9K_LINUX_DEBIAN_ICON='\u'$CODEPOINT_OF_AWESOME_LINUX

You need to replace "DEBIAN" with the name of your Linux distribution. Enter get_icon_names to get a list of all supported icons (and Linux distros).

And you should source your font files (the last line in your config) before that line.

So, POWERLEVEL9K_MODE='awesome-patched' stands before you source oh-my-zsh, right?
If so, have you restarted zsh?

thank you very much !it's very helpful!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guidoilbaldo picture guidoilbaldo  路  5Comments

jpdoria picture jpdoria  路  5Comments

edwardsmit picture edwardsmit  路  3Comments

xufab picture xufab  路  4Comments

shibumi picture shibumi  路  3Comments