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

Support more options for icon in lualine #769

Merged
merged 4 commits into from
Dec 10, 2023

Conversation

adalessa
Copy link
Contributor

@adalessa adalessa commented Dec 2, 2023

From lualine documentation the icons can be configure more than just an string

https://github.com/nvim-lualine/lualine.nvim#general-component-options

example

{'branch', icon = {'', align='right', color={fg='green'}}}

Currently is defined as string which cover for most of the cases but if you want to set a color or more is not possible. I think that adding support for raw type makes more extensible.

I think also setting an object is possible but I lack the knowledge to do so, with this I was able to extend my configuration as I needed.

Let me know what do you think.

Kind regards, thanks for maintaining the project.

Copy link
Member

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

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

Good remark, we can definitely do this.
See my proposition for what type to set :)

@@ -36,7 +36,7 @@ with lib; let
Enables the display of icons alongside the component.
'';

icon = helpers.mkNullOrOption types.str ''
icon = helpers.mkNullOrOption (types.either types.str helpers.rawType) ''
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
icon = helpers.mkNullOrOption (types.either types.str helpers.rawType) ''
icon = helpers.mkNullOrOption (with types; either str (attrsOf anything)) ''

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for showing me the change.
I am trying to test locally before pushing the change.
I am having a problem on the generation.

I think something else needs to be define maybe here https://github.com/nix-community/nixvim/blob/main/plugins/statuslines/lualine.nix#L214. in order to handle the unkeyed value for the icon.
I've tried several things with no success. maybe you can point me to some example to use as base.
Thanks.

@adalessa adalessa force-pushed the feature/lualine-icons branch from c42f686 to 1819d6b Compare December 10, 2023 10:43
@adalessa
Copy link
Contributor Author

@GaetanLepage After several tries and many errors I was able to find the solution to properly map the icon property, and from my tests works as expected. Please let me know what you think.

Copy link
Member

@GaetanLepage GaetanLepage left a comment

Choose a reason for hiding this comment

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

Perfect ! Thanks :)

@GaetanLepage GaetanLepage merged commit c1cbb00 into nix-community:main Dec 10, 2023
1 check passed
@adalessa adalessa deleted the feature/lualine-icons branch December 13, 2023 06:26
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.

2 participants