From 6253ee2a74815c7936cb6e3cb9ec48d3a6d97abf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 29 Aug 2022 20:41:07 +0530 Subject: [PATCH] Allow resetting the tab title to default --- kitty/boss.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index 76d0f6e40..80363126a 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1580,14 +1580,25 @@ def input_unicode_character(self) -> None: self.run_kitten_with_metadata('unicode_input') @ac( - 'tab', - 'Change the title of the active tab interactively, by typing in the new title. If you specify an argument' - ' to this action then that is used as the title instead of asking for it.' + 'tab', ''' + Change the title of the active tab interactively, by typing in the new title. + If you specify an argument to this action then that is used as the title instead of asking for it. + Use the empty string ("") to reset the title to default. For example:: + + # interactive usage + map f1 set_tab_title + # set a specific title + map f2 set_tab_title some title + # reset to default + map f3 set_tab_title "" + ''' ) - def set_tab_title(self, title: str = '') -> None: + def set_tab_title(self, title: Optional[str] = None) -> None: tab = self.active_tab if tab: - if title: + if title is not None: + if title in ('""', "''"): + title = '' tab.set_title(title) return args = [