Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook doesn't source shell scripts #82

Open
eilefsen opened this issue Oct 25, 2023 · 1 comment
Open

Hook doesn't source shell scripts #82

eilefsen opened this issue Oct 25, 2023 · 1 comment

Comments

@eilefsen
Copy link

I am using flavours along with the shell template to change my terminal theme, i am doing this by rewriting the file $ZDOTDIR/base16_theme.sh and sourcing it in my .zshrc.

I am however not able to create a hook to source it upon applying a new theme with flavours apply. Applying the new colors in base16_theme.sh requires re-launching the terminal (upon which it gets sourced by .zshrc), or sourcing the script manually.

Here's my config

# flavours/config.toml

shell = "zsh -c '{}'"

[[items]]
file = "~/.config/sway/colorscheme"
template = "sway"
subtemplate = "colors"
hook = "swaymsg reload"
# Swaymsg reload temporarily freezes input, so it's marked as not light
light = false

[[items]]
file = "/home/ee/.config/zsh/base16_theme.sh"
template = "shell"
rewrite = true
light = false
hook = "/home/ee/.config/zsh/base16_theme.sh"

And here's my verbose output

~ $ flavours -v apply ocean                            
Using directory: "/home/ee/.local/share/flavours"
Using config file: "/home/ee/.config/flavours/config.toml"
Using scheme: Ocean (ocean), by Chris Kempson (http://chriskempson.com)

Wrote sway/colors on "/home/ee/.config/sway/colorscheme"
running zsh -c 'swaymsg reload'
Wrote shell/default on: "/home/ee/.config/zsh/base16_theme.sh"
running zsh -c '/home/ee/.config/zsh/base16_theme.sh'
Successfully applied ocean

If i manually run zsh -c '/home/ee/.config/zsh/base16_theme.sh' after running flavours apply <theme> the theme is applied to the current terminal instance, as expected.

@titaniumtraveler
Copy link
Contributor

I think that's kind of how shells always work and not really a problem with flavours.
So you can either manually reload your colorscheme each time you use flavours apply (maybe using a shell function), or find some way to automatically update the shell environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants