You are not logged in.

#1 2023-07-30 05:54:30

ac1dn00b
Member
Registered: 2023-07-30
Posts: 5

[SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

I've been using Arch for a couple of years now and up to this point I've always been able to solve any issues by googling, but this one I couldn´t.

I'm looking into changing my workflow so I want to start using zsh with Alacritty and tmux, using the powerlevel10k theme (without Oh My Zsh). I got everything working fine until I attach tmux to Alacritty: tmux is not rendering the UTF-8 characters and is replacing them with just _ (underscores).

This is how Alacritty (and also Konsole) look without tmux:

DkP1YZX.png

And this is how it looks using tmux:

rIUwQeo.png

I have installed the Nerd Fonts package and all of them seem to be available:

fc-list : family style | grep Nerd | wc -l
1547

This is how my locale looks:

locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
locale -a
C
C.UTF-8
en_US.utf8
POSIX

I have also set UTF-8 on my .zshrc

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

I've tried two different combinations to attach tmux to Alacritty. First:
.config/alacritty/alacritty.yml

shell:
  program: /bin/tmux

And the in .tmux.conf

set-option -g default-shell /bin/zsh

Second:
.config/alacritty/alacritty.yml

shell:
  program: /usr/bin/zsh
  args:
      - -l
      - -c
      - "tmux attach || tmux"

And the in .tmux.conf

#set -g default-terminal "tmux-256color"
#set -g default-terminal "screen-256color"
#set -g default-terminal "xterm-256color"
#set -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal "screen.xterm-256color"
set-window-option -q -g utf8 on

All those variations of set -g default-terminal are the one I already tried.

And the font configuration in .config/alacritty/alacritty.yml:

font:
  normal:
    family: JetBrainsMono Nerd Font
    style: Regular

  bold:
    family: JetBrainsMono Nerd Font
    style: Bold

  italic:
    family: JetBrainsMono Nerd Font
    style: Italic

  bold_italic:
    family: JetBrainsMono Nerd Font
    style: Bold Italic

I did notice that the tmux environment does not display the locale:

tmux show-environment
DISPLAY=:0
-KRB5CCNAME
-SSH_AGENT_PID
-SSH_ASKPASS
-SSH_AUTH_SOCK
-SSH_CONNECTION
WINDOWID=65011714
XAUTHORITY=/tmp/xauth_oeMMGH

It seems to be pretty clear to me that tmux is not rendering the UTF-8 characters, but I can´t figure out why and I've run of ideas or things to try. I must have read at least 20 different tutorials on how to set it up and many more posts on troubleshooting something like this, hence all the different combinations I tried.

If anybody has any ideas it would be greatly appreciated.

Last edited by ac1dn00b (2023-07-30 21:57:40)

Offline

#2 2023-07-30 07:50:42

seth
Member
Registered: 2012-09-03
Posts: 60,689

Re: [SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

I have also set UTF-8 on my .zshrc

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

Please undo that, LC_ALL is for debugging and zshrc isn't a good place for locale configs to begin with.

And the in .tmux.conf

How about we make this

set -g default-terminal "alacritty"

?

I don't think this has anything to do w/ being able to render UTF-8 (those errors look vastly different in any case), try to copypaste

αλαcριττψ

into the terminal.
It's more likely that the powerline theme doesn't like the environment, so setting the "proper" $TERM is a good idea.

Offline

#3 2023-07-30 16:24:44

ac1dn00b
Member
Registered: 2023-07-30
Posts: 5

Re: [SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

The greek characters are rendered properly so you're right, it´s not a UTF-8 issue.

I applied the rest of the suggested changes but nothing changed, p10k is not rendered with tmux.

This is how my config files look now:

./tmux.conf

set-option -g default-shell /bin/zsh
set -g default-terminal "alacritty"
set-window-option -q -g utf8 on

./config/alacritty/alacritty.yml

shell:
  program: /bin/tmux

Offline

#4 2023-07-30 16:32:33

seth
Member
Registered: 2012-09-03
Posts: 60,689

Re: [SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

diff "printenv | sort" between the two instances, probably post both outputs.

Offline

#5 2023-07-30 19:50:17

ac1dn00b
Member
Registered: 2023-07-30
Posts: 5

Re: [SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

diff tmuxenv.txt alacrittyenv.txt
1,2c1,2
< ALACRITTY_LOG=/tmp/Alacritty-4341.log
< ALACRITTY_SOCKET=/run/user/1000/Alacritty-:0-4341.sock
---
> ALACRITTY_LOG=/tmp/Alacritty-10440.log
> ALACRITTY_SOCKET=/run/user/1000/Alacritty-:0-10440.sock
20d19
< LC_CTYPE=
29c28
< PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/android-sdk/platform-tools
---
> PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
33c32
< SHELL=/bin/zsh
---
> SHELL=/usr/bin/zsh
37,40d35
< TERM_PROGRAM=tmux
< TERM_PROGRAM_VERSION=3.3a
< TMUX=/tmp/tmux-1000/default,4351,0
< TMUX_PANE=%0
58,59c53,54
< _P9K_SSH_TTY=/dev/pts/2
< _P9K_TTY=/dev/pts/2
---
> _P9K_SSH_TTY=/dev/pts/1
> _P9K_TTY=/dev/pts/1

And this is the full output for both:
alacritty with tmux:

ALACRITTY_LOG=/tmp/Alacritty-4341.log
ALACRITTY_SOCKET=/run/user/1000/Alacritty-:0-4341.sock
ALACRITTY_WINDOW_ID=62914562
COLORTERM=truecolor
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DEBUGINFOD_URLS=https://debuginfod.archlinux.org
DESKTOP_SESSION=plasma
DISPLAY=:0
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/orlyou/.gtkrc-2.0:/home/orlyou/.config/gtkrc-2.0
GTK_MODULES=canberra-gtk-module
GTK_RC_FILES=/etc/gtk/gtkrc:/home/orlyou/.gtkrc:/home/orlyou/.config/gtkrc
HOME=/home/orlyou
INVOCATION_ID=d78f66bff994431d9b98d16f04dd038e
JOURNAL_STREAM=7:20019
KDE_APPLICATIONS_AS_SCOPE=1
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
LANG=C
LC_CTYPE=
LOGNAME=orlyou
MAIL=/var/spool/mail/orlyou
MANAGERPID=861
MOTD_SHOWN=pam
OLDPWD=/home/orlyou
P9K_SSH=0
P9K_TTY=old
PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/opt/android-sdk/platform-tools
PWD=/home/orlyou
QT_AUTO_SCREEN_SCALE_FACTOR=0
SESSION_MANAGER=local/orlyarch:@/tmp/.ICE-unix/934,unix/orlyarch:/tmp/.ICE-unix/934
SHELL=/bin/zsh
SHLVL=1
SYSTEMD_EXEC_PID=989
TERM=alacritty
TERM_PROGRAM=tmux
TERM_PROGRAM_VERSION=3.3a
TMUX=/tmp/tmux-1000/default,4351,0
TMUX_PANE=%0
USER=orlyou
WINDOWID=62914562
XAUTHORITY=/tmp/xauth_CmwWLG
XCURSOR_SIZE=24
XCURSOR_THEME=breeze_cursors
XDG_CONFIG_DIRS=/home/orlyou/.config/kdedefaults:/etc/xdg
XDG_CURRENT_DESKTOP=KDE
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=2
_=/usr/bin/printenv
_P9K_SSH_TTY=/dev/pts/2
_P9K_TTY=/dev/pts/2

alacritty without tmux:

ALACRITTY_LOG=/tmp/Alacritty-10440.log
ALACRITTY_SOCKET=/run/user/1000/Alacritty-:0-10440.sock
ALACRITTY_WINDOW_ID=62914562
COLORTERM=truecolor
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DEBUGINFOD_URLS=https://debuginfod.archlinux.org
DESKTOP_SESSION=plasma
DISPLAY=:0
GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/orlyou/.gtkrc-2.0:/home/orlyou/.config/gtkrc-2.0
GTK_MODULES=canberra-gtk-module
GTK_RC_FILES=/etc/gtk/gtkrc:/home/orlyou/.gtkrc:/home/orlyou/.config/gtkrc
HOME=/home/orlyou
INVOCATION_ID=d78f66bff994431d9b98d16f04dd038e
JOURNAL_STREAM=7:20019
KDE_APPLICATIONS_AS_SCOPE=1
KDE_FULL_SESSION=true
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=5
LANG=C
LOGNAME=orlyou
MAIL=/var/spool/mail/orlyou
MANAGERPID=861
MOTD_SHOWN=pam
OLDPWD=/home/orlyou
P9K_SSH=0
P9K_TTY=old
PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/platform-tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
PWD=/home/orlyou
QT_AUTO_SCREEN_SCALE_FACTOR=0
SESSION_MANAGER=local/orlyarch:@/tmp/.ICE-unix/934,unix/orlyarch:/tmp/.ICE-unix/934
SHELL=/usr/bin/zsh
SHLVL=1
SYSTEMD_EXEC_PID=989
TERM=alacritty
USER=orlyou
WINDOWID=62914562
XAUTHORITY=/tmp/xauth_CmwWLG
XCURSOR_SIZE=24
XCURSOR_THEME=breeze_cursors
XDG_CONFIG_DIRS=/home/orlyou/.config/kdedefaults:/etc/xdg
XDG_CURRENT_DESKTOP=KDE
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=KDE
XDG_SESSION_ID=2
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=x11
XDG_VTNR=2
_=/usr/bin/printenv
_P9K_SSH_TTY=/dev/pts/1
_P9K_TTY=/dev/pts/1

Offline

#6 2023-07-30 19:54:51

ac1dn00b
Member
Registered: 2023-07-30
Posts: 5

Re: [SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

I have just noticed that the locale has gone back to C instead of en_US.UTF-8

locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

Last edited by ac1dn00b (2023-07-30 19:55:25)

Offline

#7 2023-07-30 20:04:14

seth
Member
Registered: 2012-09-03
Posts: 60,689

Re: [SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

https://wiki.archlinux.org/title/KDE#Pl … e_settings

localectl
cat /etc/locale.conf

Maybe the powerlevel theme is smart enough to get that and alter the glyphs instead of causing stuff like "ü"…

Offline

#8 2023-07-30 21:57:02

ac1dn00b
Member
Registered: 2023-07-30
Posts: 5

Re: [SOLVED] Alacritty + Tmux not rendering fonts properly in UTF-8

That did it! Thanks a lot @seth

This is how my .config/plasma-localerc was before:

[Formats]
LANG=C

I deleted it, log out and back in and it was recreated like this:

[Formats]
LANG=en_US.UTF-8

Now Alacritty with tmux and powerlevel10k look as expected.

9Vf5PgC.png

Offline

Board footer

Powered by FluxBB