eza icon indicating copy to clipboard operation
eza copied to clipboard

bug: theme.yml doesn't work on macOS

Open virtual-voyager opened this issue 1 year ago • 12 comments

Version: v0.20.7

I have a theme.yml in ~/.config/eza/theme.yml. The theming works on my linux machine - but not on macOS. I have set $XDG_CONFIG_HOME to $HOME/.config in my .zshenv.

I tried using iTerm2 and kitty and it doesn't work on either when using macOS. I also tried setting $EZA_CONFIG_DIR to ~/.config/eza which also didn`t resolve the issue.

virtual-voyager avatar Nov 07 '24 11:11 virtual-voyager

For some reason I have not identified, I am running 0.20.3 and I have the same issue that ~/.config/eza/theme.yml is not being parsed on macOS. I do not have $XDG_CONFIG_HOME set.

kristof-mattei avatar Nov 08 '24 17:11 kristof-mattei

Okay, if you set $EZA_CONFIG_DIR to /Users/<username>/.config/eza it works. PathBuf::from("~/...") does not resolve the ~, that is a shell function.

Now, as to why it doesn't even work when you just put it in ~/.config/eza/theme.yml is because on macOS dirs.config_dir() returns $HOME/Library/Application Support

Location: https://github.com/eza-community/eza/blob/29afcb50e0d16e87ac5fd0f70976231a92d80966/src/options/theme.rs#L47

kristof-mattei avatar Nov 08 '24 18:11 kristof-mattei

What's worse is that even if you were to put your config in ~/Library/Application Support/eza/theme.yml it still doesn't work as if the theme comes from there it merely reads the default theme:

https://github.com/eza-community/eza/blob/29afcb50e0d16e87ac5fd0f70976231a92d80966/src/options/theme.rs#L50

kristof-mattei avatar Nov 08 '24 18:11 kristof-mattei

I have also experienced this issue

brandonbishopp avatar Nov 14 '24 15:11 brandonbishopp

Setting CONFIG_DIR to /Users/<username>/.config/eza Also worked for me. the comments are very vague and I thought you needed to set it to ...eza/theme.yml. it also doesn't take control of the directory or filename colours on Iterm for me. @kristof-mattei Did you have the same problem?

brandonbishopp avatar Nov 14 '24 15:11 brandonbishopp

@brandon-1999 @kristof-mattei same here, while using the absolute path instead of '~' fixed the issue of not picking up the theme on MacOS, some elements of the theme have no effect/impact e.g. the directory and filename colours (all the filekinds theme overrides don't work really):

https://github.com/eza-community/eza-themes/blob/main/themes/tokyonight.yml#L3-L13 https://github.com/eza-community/eza/blob/v0.20.9/src/theme/default_theme.rs#L28

dimosped avatar Nov 27 '24 02:11 dimosped

eza also cannot import configured themes on linux, even though I have set the EZA_CONFIG_DIR environment variable. But on Windows, this can be solved by setting the EZA_CONFIG_DIR environment variable.It is strongly recommended to add a config.toml configuration file like lsd, which can be customized. After all, some columns are not used on Windows. Although I have configured the theme and configuration file of lsd, lsd starts very slowly when importing the configuration and theme on Windows. Fortunately, the speed of Linux is OK; I hope eza can support customized configuration while starting quickly.

leij0318 avatar Dec 07 '24 14:12 leij0318

I am (was) having the same issue. Setting the full path for $EZA_CONFIG_DIR helped but a theme.yml in the folder is ignored. It was only after I created a theme.yml link in ~/Library/Application Support/eza (had to manually create eza dir) that things began working.

Here is what got me working:

My .zshrc:

EZA_CONFIG_DIR=/Users/<username>/.config/eza
XDG_CONFIG_HOME=/Users/<username>/.config

Theme repo is cloned into ~/.config/eza/ so things look like this:

❯ tree -d ~/.config/
/Users/<username>/.config/
├── eza
│   ├── eza-themes
│   │   ├── imgs
│   │   └── themes
│   ├── test_dir
│   │   └── src
│   └── themes
mkdir ~/Library/Application\ Support/eza

cd ~/Library/Application\ Support/eza

ln -sf $EZA_CONFIG_DIR/eza-themes/themes/tokyonight.yml ./theme.yml

Confirm:

eza -lh --icons $EZA_CONFIG_DIR/test_dir

Sadly, I only came across this discussion when I was a few hours into troubleshooting this. Thank you kristof-mattei for providing the piece that allowed for forward progress.

itdojo avatar Dec 24 '24 06:12 itdojo

To test this, I created theme.yml (an actual file, not a symlink) in both these locations on macOS 15.5:

~/Library/Application\ Support/eza/theme.yml
~/.config/eza/theme.yml

Only the theme at ~/Library/Application\ Support/eza/theme.yml is picked up by eza 0.23.0, no matter what I put in the ENV variables.

EDIT: Interestingly, when I set the ENV variables to an invalid path (as I first accidentally did like this:)

export EZA_CONFIG_DIR=/Users/<username>/.config/eza/theme.yml
export XDG_CONFIG_HOME=/Users/<username>/.config/eza/theme.yml

then no theme is picked up at all. So the variables clearly do something, but even when set to the proper path, they don't have the desired effect.

halo avatar Aug 19 '25 17:08 halo

Just chiming in. Appears I have the same issue happening. And no variation of above appears to be solving my issue for me. I can't get ANY theme.yml to be read.

This is with eza installed with homebrew, fwiw

EliW avatar Sep 26 '25 15:09 EliW

Same here, doesn't seem to work on arch linux. Tried every single combination of $EZA_CONFIG_DIR I could think of

zveinn avatar Oct 23 '25 16:10 zveinn

If someone using Linux has this problem where eza suddenly stops displaying colors, it may be a conflict with the LS_COLORS variable.

put in your .bashrc/zshrc

unset LS_COLORS

PedrelliMath avatar Oct 31 '25 15:10 PedrelliMath