Zsh icons broke in urxvt

9,225

Solution 1

First of all, there is a significant difference between the terminals types rxvt and unicode-rxvt (often abbreviated to urxvt). You have indicated that the terminal you are using is "URXVT Version 9.22", so to avoid confusion, please use the correct name which is not rxvt but urxvt.

As Mikel has pointed out, the Xresources file is telling urxvt to use the 9x15 font which is (a) the old style X11 server provided font method and (b) a limited capability bitmap font.

The oh-my-zsh Github README file explains

many themes require installing the Powerline Fonts in order to render properly

So in order to show the correct arrow shape you need to have the terminal using the appropriate font. Perhaps your update which broke the feature was an update which reset the font usage by urxvt?

As you state that sterminal displays the prompt correctly, check which font that is using, then change the .Xresources in your ${HOME} directory to use that font after verifying that it works with the manual test urxvt -font "font_name". (For the newer method of Xft supplied fonts, font_name is preceeded by "xft:" and followed by ":size=12" for font size).

Having checked in my urxvt, it seems quite a number of well known truetype and opentype monospace fonts do not provide the "right arrow" glyph and just show an empty box. However one readily available standard font that does work (and should be installed on your system) is Deja Vu Sans Mono.

So try firing up a urxvt with

urxvt -font "xft:Deja Vu Sans Mono:size=12" &

and see if your prompt is correctly displayed.

Take a look at https://bbs.archlinux.org/viewtopic.php?id=173477 for discussion on modifying font resource specification for urxvt in an Xresources/Xdefaults file.

PS Do not forget that you can use multiple urxvt terminals more efficiently if you first start the urxvtd daemon and then fire up terminals with urxvtc.

ADDENDUM

Thanks for confirming that you are using urxvt and you have DejaVu Sans Mono installed.

Confirm that there is no font substitution happening with the command entered in terminal at the prompt

   fc-match  "DejaVu Sans Mono"

producing the output

   DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

The actual font file location and styles available for the font can be verified with

    fc-list | grep --color 'DejaVu Sans Mono'

Now assuming that is all okay, you need to check by firing up a urxvt from the command line of a terminal (sorry for not making that absolutely clear above and I had space between Deja and Vu which might have caused a problem)

    urxvt -font "xft:DejaVu Sans Mono:size=12" &   

that you can cut'n'paste the right-arrow character (from here) "➜" into that urxvt and that it displays correctly which I have checked does work.

I can also confirm that putting the following into an Xresources file

 URxvt.font:                     xft:DejaVu Sans Mono:autohint=true:size=12
 URxvt.boldFont:                 xft:DejaVu Sans Mono:autohint=true:bold:size=12
 URxvt.italicFont:               xft:DejaVu Sans Mono:autohint=true:italic:size=12
 URxvt.boldItalicFont:           xft:DejaVu Sans Mono:autohint=true:bold:italic:size=12

and loading into the Xorg server resource database with xrdb -merge Xresource_file_name to be 100% certain those values will be used and then firing up a terminal with just urxvt at the command line results in a terminal in which the font correctly shows the right arrow character. (you should also notice that characteristic of this font, the l characters are curly and that there is a dot in the center of the zero characters).

The font I normally use in urxvt "Luxi Mono" (easier to read, easy on the eyes IMHO) does not display the right arrow correctly even though the "font-manager" program reveals that "Luxi Mono" does have the glyph. Similarly xterm is also broken but a test in lxterminal, mate-terminal, and xfce4-terminal (checked in preferences that font is set to Luxi Mono) all display the right-arrow correctly. So it does appear that something is broken for some fonts in urxvt and xterm (which if I understand correctly share some code origins) just as the others which work similarly share some common code viz libvte.

Solution 2

I too am using the i3wm community edition of Manjaro Linux (18.0.4 Illyria) and URXVT Version 9.22. I had exactly the same problem on installing Oh My Zsh.

Following J G Miller's comprehensive and useful advice I edited my ~/.Xresources file as suggested, and it worked. Fantastic!

Until I opened Manjaro's pre-installed file manager - ranger (terminal based with vi keybindings). The change to ~/.Xresources now malformed the icons in this application.

Finding a similar stack overflow question I (after reverting the above change) amended my ~/.Xresources file from:

URxvt.font:      9x15,xft:TerminessTTFNerdFontMono

to:

URxvt.font:      9x15,xft:TerminessTTFNerdFontMono,xft:DejaVu Sans Mono:autohint=true:size=12

My understanding is that the above means the Manjaro i3 default fonts are used for ranger, but then when a non-recognised glyph is encountered (such as the ones in Oh My Zsh) DejaVu Sans Mono is used instead. Both applications now display correctly.

Thanks to J G Miller however for the right direction to follow.

Share:
9,225

Related videos on Youtube

KnownAsDon
Author by

KnownAsDon

I am a young teen just starting off in the world of programming and fortunetaly for his good luck he has such a good forum to help him climb up!

Updated on September 18, 2022

Comments

  • KnownAsDon
    KnownAsDon over 1 year

    so I am currently using manjaro linux and I am using urxvt as my terminal which I love so before all this starts switching the terminal is not an option, sorry if I am being rude.

    I installed zsh to it as my default shell and added the theme robbyrussell throught oh-my-zsh. At first it was all fine and everything was working but after an update my icons broke. Particulary(if you are fimiliar with the theme) the arrow icon broke and same with all the icons in all the other themes.

    This problem occurrs only with urxvt because when I try with some other terminal such as sterminal the theme works.

    Some screenshots you can see here This is how it's supposed to look(screenshoots taken from sterminal)

    And this is how it looks(screenshoots taken from rxvt)

    I have been asking for help in reddit, github repos such as oh-my-zsh and robbyrussell officiall repo but no one seemed to help me, so I really am hoping you guys will give me a help.

    Here are some information about my os and terminal:

    URXVT Version 9.22
    Operating System : Manjaro i3 4.12.24-1
    No Desktop Envoirment
    i3wm as window manager
    

    I am using default oh-my-zsh configurations for my zshrc file and default Xreources from manjaro i3 which you can find here. If you need further information just tell me. Any help would be greatly appreciated!

    • Admin
      Admin about 6 years
      URxvt.font: 9x15 in your Xresources seems suspicious. Not sure if it supports those glyphs.
    • Admin
      Admin about 6 years
      that seemed to work brefore and that is preconfigured and highly suggested about the distro developers...but what do you suggest me to do?
    • Admin
      Admin about 6 years
      I did try to change it's values and even disable and none of them made any diffrence except messing with the font size
  • KnownAsDon
    KnownAsDon about 6 years
    First of all thank you for telling me the diffrence betwen urxvt and rxvt and apperantly...yes i am using urxvt. Now as much as I love urxvt I also am pretty new to it and pretty unexperienced with its configurations...I tried adding the line you suggested in my Xresources and that just made my font thinner and letterspacing got all messed up and I also can confirm that I do have the Deja Vu Sans Mono font installed (it was pre-installed).I am still learning linux so if you can make the answer a little bit simpler I would be really greatful!
  • ryanv
    ryanv almost 5 years
    Using the same Manjaro Linux (18.0.4 Illyria) and URXVT Version 9.22, I got all glyphs in ranger and the arrow in robbyrussell theme to display using: URxvt.font: xft:DejaVu Sans Mono:autohint=true:size=12,xft:TerminessTTFNerdFontMono:size‌​=12
  • Concrete_Buddha
    Concrete_Buddha almost 5 years
    @ryanv Thanks for the comment - realised I made a typo, I started the code snippet with 'xvt' rather than 'URxvt', now corrected. Regards your code, I think this means DejaVu is preferred to Terminess; but all good if that is what you like!