Closed twnaing closed 1 month ago
Thanks for creating the issue. What would imagine the config item look like for this? hook_init
and hook
for normal and hook
is executed if hook_init
doesn't exist for init? Trying to figure out a way to get it done without making it overly complex
On a second thought, I think I am having this feature request because
init
and apply
do the almost same thing and init
in every terminal I open. (USAGE.md instruction do the init
while aliasing tinty_source_shell_theme
)Currently
init
in shell *rc (and refraining myself from using tinty init
)tinty apply
when I want to change theme)works the way I want.
Making two hooks seem complex.
I'm glad you've got it working like you'd like. Yeah I do see the issue with init
and apply
and how it can be confusing. init
is currently basically tinty apply $(tinty current)
which does make me question the necessity of init
subcommand in the first place if it's not very different from apply
.
As Tinty have already offloaded "a bit of work" to the hook, passing of the command (init
or apply
as a template variable) to hook could be less complicated.
Users will have the freedom to do what they want in the hook.
Just a opinion.
Can you give a config.yaml example of that suggestion?
assume %m
is command mode (i.e. init or apply) the config will be like
[[items]]
name = "base16-i3"
path = "https://github.com/tinted-theming/base16-i3"
themes-dir = "colors"
hook = '[ "%m" = "apply" ] && cp -f %f ~/.config/i3/colors && cat ~/.config/i3/colors ~/.config/i3/base > ~/.config/i3/config && i3-msg reload'
Added a PR for this: https://github.com/tinted-theming/tinty/pull/73
Just released the changes, let me know if things aren't as expected.
Is your feature request related to a problem? Please describe.
No, it is not.
Describe the solution you'd like
Solution: skip the hook if it is not
apply
Reason: there are cases where hook is used to create config file such as copying the template file
cp -f %f ~/.config/i3/color
. Such kind of hook is only required when we are applying new theme, AFAIK. If we can skip the hook oninit
we can increase speed and reduce resource usage.Describe alternatives you've considered
The alternative could be
a. different hooks for apply and init b. pass
init
orapply
to hook as a template variable and deal with the resource usage in the hook commandAdditional context
The following config always create config file and reload the i3 every time
tinty init
is called.