tinted-theming / tinty

A base16 and base24 color scheme manager
MIT License
31 stars 3 forks source link

[Question] running tinty init in .zshrc #19

Closed laenzlinger closed 2 months ago

laenzlinger commented 2 months ago

What version of tinty are you using? [paste the output of tinty --version here] tinty 0.11.0 alacritty 0.13.2 (bb8ea18e)

I am migrating from chriskempso/base16-shell to tinty + tinted-theming/base16-shell

cat .config/tinty/config.toml
# Global settings
shell = "zsh -c '{}'"
default_scheme = "base16-darktooth"

[[items]]
name = "shell"
path = "https://github.com/tinted-theming/base16-shell"
themes_dir = "scripts"
hook = ". %f"

when I run tinty init, the colors are correctly changed,

however, when i run tinty init in my .zshrc it the colors are not initialized when I open a new alacritty terminal.

Any hints for how to further debug are very much appreciated.

JamyGolden commented 2 months ago

Hi and welcome @laenzlinger :smile: Are you getting any errors? (I'm guessing not). Try running tinty current right after your .zshrc tinty init just to make sure it's working. When you open a new terminal window, this should output the name of the theme that should be applied.

I would imagine that this might be because tinty isn't in your PATH yet in .zshrc but then I'd expect an error when you open a new window.

laenzlinger commented 2 months ago

Thanks @JamyGolden for the quick reply!

I have changed my .zshrc

#... more initialization above (oh-my-zsh)

export PATH=$PATH:$HOME/.cargo/bin

tinty init
tinty current

(tinty was installed with cargo install and I exported the cargo bin path before tinty is called)

-- console output produced during zsh initialization follows --

base16-black-metal-dark-funeral
JamyGolden commented 2 months ago

Can you try to manually source the theme file? So add . ~/.local/share/tinted-theming/tinty/shell-scripts-file.sh to your .zshrc file and see if that loads the shell theme when you open a new window. Make sure that files exists though, it might be in a different location depending on your OS. (this isn't the solution if it works, still just a debugging step)

laenzlinger commented 2 months ago

yes this helps (I am using arch linux)

env | grep BASE
BASE16_THEME=brewer

I guess it was a wrong assumption that I should call tinty init in my .zshrc. Instead i should directly source the applied shell script.

laenzlinger commented 2 months ago

I found 2 problems:

On my system, tinty does not see the config file ~/.config/tinty/config.toml. I have to add -c ~/.config/tinty/config.toml. Without that, it seems to use an internal default config.

Once I added -c, i found that in my config file, tinty reported an error. (I copied the example from the README.md file of this repository, which contains the same error: The key themes_dir should be themes-dir.

JamyGolden commented 2 months ago

Ahh ok thanks for going through all of this. Yes it looks like documentation errors which I've just cretead a PR addressing these issues https://github.com/tinted-theming/tinty/pull/20.

The reason it didn't find the config without you specifying is that the default config path is ~/.config/tinted-theming/tinty/config.toml. I'll add a command which returns the config and data paths being used to make this sort of thing easier to debug.

Is this resolved for you now using the -c? You could either continue using that path or use the default of ~/.config/tinted-theming/tinty/config.toml

laenzlinger commented 2 months ago

Oh sorry, now I understand! No problem for me to use the default path instead of my own path. I don't remember why my path would be correct. Maybe the defaults could be mentioned in --help. I think that would have resolved it for me.

JamyGolden commented 2 months ago

Yeah I'll make sure to do more to explain it. In the PR I created I fixed 2 instances of a path which mimics the path you were using so the docs incorrectly mentioned the path in 2 places. I'll merge that PR now. I'll close this issue since it seems like it's sorted. I've added a feature request issue to add something to help debug this type of issue in future: https://github.com/tinted-theming/tinty/issues/21