nekowinston / wezterm-bar

WezTerm Plugin for the retro tab bar
MIT License
35 stars 13 forks source link

Make tabs pick custom name if they have been renamed #2

Open griimick opened 6 months ago

griimick commented 6 months ago

I added a keybind to rename active tab title as described in here and am trying to make the plugin pick the custom renamed title.

Then, made a change in the format-tab-title event handler to get the custom title using tab:get_title() instead of tab.active_pane.title. I am getting this unexpected output.

lmk if you have inputs on what I might be doing wrong. Thanks!

After change: ("nani" was set using the keybind that uses tab:set_title(line))

image

Original:

image
griimick commented 6 months ago

It works now! Let me know if you think it's a good addition to plugin, I can open PR.

image
eljamm commented 6 months ago

I wanted to have the abiltiy to hide or show inactive tabs and I found your proposal, so I decided to combine them :smile:

You can include it in your PR if the author thinks it's a good idea.

    local function hide_or_display_inactive(tabtitle)
      if not tab.is_active and C.tabs.hide_inactive.enabled then
        return ""
      end
      return tabtitle
    end

    local tabtitle = tab.tab_title
    if #tabtitle > 0 then
      if not C.tabs.hide_inactive.ignore_renamed then
        tabtitle = hide_or_display_inactive(tabtitle)
      end
    else
      tabtitle = hide_or_display_inactive(tab.active_pane.title)
    end

I have the following config structure in mind, but we can change it to something else if it makes more sense:

  tabs = {
    hide_inactive = {
      enabled = false,
      ignore_renamed = false,
    },
  },

Examples:

Screenshot from 2024-04-10 21-59-25

Screenshot from 2024-04-10 22-03-52

Screenshot from 2024-04-10 22-00-39