gokcehan / lf

Terminal file manager
MIT License
7.47k stars 321 forks source link

Icons aren't displaying properly #583

Open kamui-fin opened 3 years ago

kamui-fin commented 3 years ago

I used the wiki article for adding icons to lf through the LF_ICONS env variable. I also have nerd fonts already installed, yet, it doesn't seem to be displaying properly. This screenshot is with the st terminal but i've also tried it on the kitty terminal and it still doesn't display the icons properly.

image

Is this a bug or could I have configured something wrong?

gokcehan commented 3 years ago

@kamui-7 This is not intended behavior. Can you try this without setting any icons? (e.g. LF_ICONS= lf) If it's working, can you try with a minimal example? (e.g. LF_ICONS='di=:*.c=' lf). Also what shell are you using? This might also be an encoding issue. Are you using utf-8 in your terminal? Also what are your language variables? (e.g. LC_ALL, LC_CTYPE, and LANG)

cubercsl commented 2 years ago

The same problem.

LANG=en_US.UTF-8 LF_ICONS='di=:*.c=' lf

图片

LANG=zh_CN.UTF-8 LF_ICONS='di=:*.c=' lf

图片
ndavd commented 2 years ago

what shell are you using in lf? if it is zsh make sure to check this out

cubercsl commented 2 years ago

what shell are you using in lf? if it is zsh make sure to check this out

I am using fish in alacritty.

btrkeks commented 2 years ago

I have exactly the same issue when using Japanese locales.

gokcehan commented 2 years ago

@GenjiFujimoto I can produce similar glitches with tcell hello world example with different locales so I suspect this is a tcell issue.

pezcore commented 1 year ago

I am seeing some, but not all, icons display incorrectly. Namely, the directory icon and the jpeg icon:

lf

I am seeing this in both kitty and alacritty. I believe this is related to lf because when I cat the icons file the directory icon displays correctly in the same terminal:

icons_file

Also, if it helps, My terminal it kitty, my shell is zsh 5.9, my font is JetBrains Mono and my LANG is en_US.utf8. My current config correctly display Nerdfont icons in every other application except lf

My lf version is r27

copypasteonly commented 1 year ago

Hello have you found the solution to this? I've the same setup as yours except that my font is Codelia patched with NerdFont, my directory icon is the one that's not working.

ilyagr commented 1 year ago

I've investigated this a bit, but found no solution. It seems that the reason for this behavior is that the symbol lf's icons.example uses to show directories is not a valid Unicode symbol. Only some hacked fonts (e.g. Nerdist) show it as a folder. Other fonts show it as the J-like squiggle shown on @pezcore's screenshot. (Most fonts show nothing at all).

In my case, also on Kitty throug tmux (Debian, running on Chrome OS which may or may not interfere with fonts), I've noticed that (Update:) selecting the J-like symbol in tmux's copy mode (^B [) turns it into a folder symbol.

(Update: I previously said this, but couldn't reproduce it: "if I paste the folder symbol into Vim (or open the icons.example file) and move the cursor over it, it turns into the J-like squiggle.")

You can try to find out why Kitty seemingly falls back to another font and how to force Kitty to use Nerd fonts everywhere. In any case, this seems like a Kitty or font problem, not an lf problem.

mymmrac commented 1 year ago

@kamui-fin this can be because you are using Nerd Font Mono instead of Nerf Font (regular)

For example, JetBrainsMono Nerd Font will be displayed properly, but JetBrainsMono Nerd Font Mono will be the same as for you (at least on my machine)

Try to change your font, maybe this will help

DusanLesan commented 1 year ago

Maybe you can try using custom icon definitions. I have not even used icons bit to me it looks straightforward. I have seen implementation in Luke Smith's dotfiles.

PierrotAWB commented 1 year ago

@cubercsl Sorry for the bump, but can you post the output of grep -v ^# /etc/locale.gen? I had this issue earlier and setting LANG was insufficient. Uncommenting the relevant line (en_US.UTF-8 UTF-8) in the foregoing file fixed my issue. Seemed to have something to do with system locale.

MagnesiaReal commented 1 year ago

I am seeing some, but not all, icons display incorrectly. Namely, the directory icon and the jpeg icon:

lf

I am seeing this in both kitty and alacritty. I believe this is related to lf because when I cat the icons file the directory icon displays correctly in the same terminal:

icons_file

Also, if it helps, My terminal it kitty, my shell is zsh 5.9, my font is JetBrains Mono and my LANG is en_US.utf8. My current config correctly display Nerdfont icons in every other application except lf

My lf version is r27

I found maybe a hacked solution

go to your kitty.conf and set: symbol_map U+1000-U+ffee JetBrainsMono Nerd Font that's all

coma409 commented 1 year ago

@GenjiFujimoto I can produce similar glitches with tcell hello world example with different locales so I suspect this is a tcell issue.

Thanks for the hint ,I think it is the tcell's issue.

https://github.com/microsoft/terminal/issues/370#issue-408548048 https://github.com/gdamore/tcell/issues/531#issue-1240220589

In CJK environment ,Ambiguous width character will be glyphs to a different width.

I fix it by set the envirement export RUNEWIDTH_EASTASIAN=0 in my $HOME/.xprofile.

export LANG="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"

export GDK_SCALE=2
export GDK_DPI_SCALE=0.5
export QT_AUTO_SCREEN_SCALE_FACTOR=

export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx

export GOROOT=/usr/lib/go
export GOPATH=$HOME/go
export GOBIN=$HOME/go/bin
export PATH=$PATH:$GOROOT/bin:$GOBIN
export GO111MODULE=on

export RUNEWIDTH_EASTASIAN=0

lf_2

OS: ArchLinux x86_64 Locale: LANG=zh_CN.UTF-8 Terminal Emulator: Alacritty

pingarelho commented 8 months ago

I am seeing some, but not all, icons display incorrectly. Namely, the directory icon and the jpeg icon:

lf

I am seeing this in both kitty and alacritty. I believe this is related to lf because when I cat the icons file the directory icon displays correctly in the same terminal:

icons_file

Also, if it helps, My terminal it kitty, my shell is zsh 5.9, my font is JetBrains Mono and my LANG is en_US.utf8. My current config correctly display Nerdfont icons in every other application except lf

My lf version is r27

currently having this exact issue

promitheas17j commented 7 months ago

Experiencing this issue as well. Currently only noticed with jpeg files. Instead of the picture icon it displays a rocket icon.

2023-11-29_00-18 2023-11-29_00-25

What I did is copy-paste a lot of the contents of the example file into my icons file in the lf directory. The I added the line set icons in my lfrc.

BluishHumility commented 1 month ago

The terminal needs to be configured to use a nerd font to properly show the glyphs in the example file. You can either configure a nerd font as the primary font of the terminal, or you can install ttf-nerd-fonts-symbols and configure the terminal to use that as a fallback font.

Having a nerd font installed is not enough; it is possible to have a nerd font installed but configure your terminal to use the "regular" version of the font, in which case the icons will not show up correctly.

When you are configuring the font, check fc-list to be sure you are getting the spelling and capitalization of the font exactly right when you add it to your terminal config. If you don't type it exactly right it won't work. Check fc-list | grep -i nerd to see what your options are for nerd fonts if you aren't sure.

Using Foot terminal as an example, if I set my font like this, it displays the glyphs correctly:

font=JetBrainsMonoNerdFont-Regular:size=13

Using a non-nerd font for the primary terminal font and configuring the symbols font as a fallback also works.

font=JetBrainsMono-Regular:size=13,SymbolsNerdFont-Regular:size=13

Setting the font to just JetBrainsMono-Regular without adding the nerd symbols fallback font does not work. Without any nerd font explicitly set, the glyphs will be displayed as they are in the various screenshots in this thread.

In my opinion this isn't really an lf issue; as far as I can tell everything is working correctly. It's more of a seemingly common font configuration issue.