eza-community / eza

A modern alternative to ls
https://eza.rocks
European Union Public License 1.2
11.69k stars 211 forks source link

bug: tmux breaks --color-scale with wayland #743

Open draptik opened 9 months ago

draptik commented 9 months ago

When using eza with --color-scale within tmux the color-scale option is ignored.

❯ eza --version       
eza - A modern, maintained replacement for ls
v0.17.0 [+git]
https://github.com/eza-community/eza
eza -l --color-scale

screenshot

Can I provide any further infos?

MartinFillon commented 9 months ago

This clearly looks like a tmux color handling error as we dont have any code that specifies if that term do this please send this error to tmux and keep us updated, you can close this if you want or refer it in the tmux issue

draptik commented 9 months ago

OK, thanks for the quick feedback @MartinFillon ! I'll try to get some infos from tmux and report back if I there's anything relevant.

MartinFillon commented 9 months ago

according to @PThorpe92

yeah tmux you have to have $TERM = xterm-256color in your env. i'll bet they are using alacritty

PThorpe92 commented 9 months ago

@draptik https://gist.github.com/andersevenrud/015e61af2fd264371032763d4ed965b6

check this out, even though it is neovim related, it should help out.

draptik commented 9 months ago

@MartinFillon @PThorpe92 thanks for the pointers!

I've dumbed down my ~/.tmux.conf and ~/.config/alacritty/alacritty.yml to the examples provided in the gist. The bash-24 script shows the correct colors in all terminals (alacritty, kitty, gnome-terminal). Also in tmux, in all terminals.

This screenshot shows alacritty with tmux:

image

This screenshot shows alacritty without tmux:

image

I am at a loss what to try next. Any ideas? I'm still testing different permutations from the comments in the gist, but I'm not feeling lucky.

PThorpe92 commented 9 months ago

Ok so I had recently moved to wezterm, but I just tried out Alacritty again and it does indeed work with tmux. image .tmux.conf

set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # underscore colours - needs tmux-3.0
set -ga terminal-overrides ",*256col*:Tc"

alacritty.yml

env:
  TERM: xterm-256color

Maybe give that a go?

draptik commented 9 months ago

@PThorpe92 Mmh, this is strange. Still no luck, even when using your configs. Which other environment variable might be involved? This should not be a X11/Wayland issue, right? I'm on Wayland, in case that matters.

PThorpe92 commented 9 months ago

I am indeed on X11. Let me try it on my other laptop I have sway/wayland installed give me a few mins :+1:

PThorpe92 commented 9 months ago

@draptik it seems you are right

So I mostly SSH into that laptop so i hadn't actually setup tmux w/ alacritty how I had it on this one. I configured it properly and the fix for the background worked, but it looks very much like your screenshots. Those colors aren't working, it is indeed somehow a wayland thing.

So it just so happens, I literally rewrote most of the color-scale feature today. I am going to do some experimenting, but I doubt this is actually in our control. I'll ping you if I learn anything new :+1:

draptik commented 9 months ago

@PThorpe92 thanks for the quick update! I would have never guessed this being a wayland-thing. In case you need somebody to double-check results: Just ping me!