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

Help with custom function embedded within the sections for tab_inactive #45

Open
ChrisGVE opened this issue Nov 21, 2024 · 1 comment
Open

Comments

@ChrisGVE
Copy link

I am seeking help defining a custom function within the sections.tab_inactive setup.

In short, I would like to be able to set attributes programmatically such that the following would work:

local function has_unseen_output(tab)
  local response = false
  for _, pane in ipairs(tab.panes) do
     if pane.has_unseen_output then
        response = true
     end
  end
  return response
end

...

tabline.setup({

...

tab_inactive = {
  { Foreground = { Color = function(tab, hover)
       if hover then
          return "blue"
       elseif has_unseen_output(tab) then
          return "red"
       else
          return "black"
       end, } },
   "index",
...
},

There must be a more efficient way to do this, but that's the general idea.

@michaelbrusegard
Copy link
Owner

I think the best approach is either to create your own custom component or to return the desired component with the desired values directly from a function

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