Make always-visible '+' new tab button opt-in via tab_bar_show_new_tab_button

Default is 'no' to avoid forcing the button on all kitty users. When disabled,
the '+' indicator still appears during window drags as a drop target (existing
behaviour). Set to 'yes' to keep it permanently visible as a clickable button.
This commit is contained in:
mcrmck 2026-03-22 17:13:08 -04:00
parent 412cd30cd2
commit 3e85db684d
2 changed files with 13 additions and 1 deletions

View file

@ -1635,6 +1635,16 @@
'''
)
opt('tab_bar_show_new_tab_button', 'no', option_type='to_bool', ctype='bool',
long_text='''
When set to :code:`yes`, a :code:`+` button is always shown at the end of the
tab bar as a clickable shortcut to open a new tab. When set to :code:`no`
(the default), the button is hidden at rest but still appears temporarily
while a window is being dragged, so it can be used as a drop target to open
the window in a new tab.
'''
)
opt('tab_bar_min_tabs', '2', option_type='tab_bar_min_tabs',
long_text='The minimum number of tabs that must exist before the tab bar is shown.'
)

View file

@ -1607,13 +1607,15 @@ def tab_bar_data(self) -> Sequence[TabBarData]:
dragged_tab_id, drag_started = get_tab_being_dragged()[:2]
if drag_started:
tab_being_dragged_from_here = self.tab_for_id(dragged_tab_id) is not None
window_drag_active = get_window_being_dragged()[1]
if self.tab_being_dropped is None:
wdtt = self.window_drag_target_tab_id
if tab_being_dragged_from_here:
tabs = tuple(t.data_for_tab_bar(t is at or t.id == wdtt) for t in self.tabs_to_be_shown_in_tab_bar if t.id != dragged_tab_id)
else:
tabs = tuple(t.data_for_tab_bar(t is at or t.id == wdtt) for t in self.tabs_to_be_shown_in_tab_bar)
tabs = tabs + (self._new_tab_drop_indicator(),)
if window_drag_active or get_options().tab_bar_show_new_tab_button:
tabs = tabs + (self._new_tab_drop_indicator(),)
return tabs
tmap = {t.id:t for t in self.tabs}
at = self.active_tab