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

feat: support themes directory #1577

Merged
merged 7 commits into from
Jul 24, 2022
Merged

feat: support themes directory #1577

merged 7 commits into from
Jul 24, 2022

Conversation

jaeheonji
Copy link
Member

@jaeheonji jaeheonji commented Jul 10, 2022

Resolve #1491

EDIT: The theme_dir option was removed due to another issue. Therefore, themes directory always exists under the zellij config directory.

@jaeheonji jaeheonji marked this pull request as ready for review July 17, 2022 06:36
@jaeheonji
Copy link
Member Author

@a-kenji Hi!

I plan to merge this PR if there are no problems.
Do you have any feedback for this PR?

@a-kenji
Copy link
Contributor

a-kenji commented Jul 17, 2022

@jaeheonji,
Awesome. I will be home soon, then I will have a look. Why wasn't the theme directory configuration working?

@jaeheonji
Copy link
Member Author

@a-kenji Thank you!

Why wasn't the theme directory configuration working?

When I try to add new options, I get a large_enum_variant error in clippy. It seems that there are several ways to solve it, but this problem seems to belong to a larger category, so I will try to solve it separately.

Copy link
Contributor

@a-kenji a-kenji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this, it is pretty awesome!

There are a few things that can get addressed:

I think the serialization should be done in the setup step itself, that way the themes specified in the config and the themes directory can get merged. And people can have some themes in their config and some in the directory. This will also take some logic outside of the client, and make it possibly less error prone.

What do you think about allowing the name of the theme in the theme itself? That way it would be more portable and you could copy your theme from a theme directory into the configuration file.
In the same vein, could it make sense to allow specifying related themes inside the same file?
For example molokai.yaml having a molokai-dark and a molokai-light.

Also it would be great, if you could add the theme directory to zellij setup --check!

What do you think?

zellij-client/src/lib.rs Outdated Show resolved Hide resolved
zellij-utils/src/input/theme.rs Outdated Show resolved Hide resolved
@a-kenji
Copy link
Contributor

a-kenji commented Jul 17, 2022

@a-kenji Thank you!

Why wasn't the theme directory configuration working?

When I try to add new options, I get a large_enum_variant error in clippy. It seems that there are several ways to solve it, but this problem seems to belong to a larger category, so I will try to solve it separately.

Ah, yes that makes sense.
Depending on how you want to solve it it can be a bigger item.
Boxing, or allowing this particular large enum variant, probably won't have a large negative impact.

@jaeheonji
Copy link
Member Author

I think the serialization should be done in the setup step itself, that way the themes specified in the config and the themes directory can get merged. And people can have some themes in their config and some in the directory. This will also take some logic outside of the client, and make it possibly less error prone.

What do you think about allowing the name of the theme in the theme itself? That way it would be more portable and you could copy your theme from a theme directory into the configuration file.
In the same vein, could it make sense to allow specifying related themes inside the same file?
For example molokai.yaml having a molokai-dark and a molokai-light.

You're right. I initially thought of two ways. The first, as you mentioned, is to merge themes by loading individual files during the setup process. The second is to look up themes in the config first, and load the file if there is no theme in the config.

Both are good methods, but I did not choose the first method because it seems that there will be more File I/O than the second method. (Of course, it usually won't affect performance that much.)

However, if it is an example like molokai, I think the first method is fine. And, it seems that some edge cases can be solved.

Also it would be great, if you could add the theme directory to zellij setup --check!

I agree 100% 👍

Ah, yes that makes sense.
Depending on how you want to solve it it can be a bigger item.
Boxing, or allowing this particular large enum variant, probably won't have a large negative impact.

Cool! It will be helpful.

Thank you so much for the feedback and finding the missing parts. It will take some time to fix 😅

@jaeheonji jaeheonji requested a review from a-kenji July 20, 2022 14:20
@jaeheonji
Copy link
Member Author

jaeheonji commented Jul 21, 2022

@a-kenji I updated it. please check it out when you have time 😄

@a-kenji
Copy link
Contributor

a-kenji commented Jul 24, 2022

This is very awesome, and it works now as I expect it! Thanks for the great work.

@jaeheonji jaeheonji merged commit 09481aa into zellij-org:main Jul 24, 2022
This pull request was closed.
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

Successfully merging this pull request may close these issues.

put themes in a folder
2 participants