From 3e85db684d1157fa2f00d4974259214417663ed7 Mon Sep 17 00:00:00 2001 From: mcrmck Date: Sun, 22 Mar 2026 17:13:08 -0400 Subject: [PATCH] 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. --- kitty/options/definition.py | 10 ++++++++++ kitty/tabs.py | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/kitty/options/definition.py b/kitty/options/definition.py index d6dc751b0..f660e71dc 100644 --- a/kitty/options/definition.py +++ b/kitty/options/definition.py @@ -1635,6 +1635,16 @@ The horizontal alignment of the tab bar, can be one of: :code:`left`, ''' ) +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.' ) diff --git a/kitty/tabs.py b/kitty/tabs.py index 39815262a..e68034729 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -1607,13 +1607,15 @@ class TabManager: # {{{ 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