Allow the set_tab_title action to take an argument

This commit is contained in:
Kovid Goyal 2022-08-29 20:11:18 +05:30
parent 9eabc9ecf1
commit 5b28aed0b1
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 10 additions and 3 deletions

View File

@ -1579,10 +1579,17 @@ class Boss:
def input_unicode_character(self) -> None:
self.run_kitten_with_metadata('unicode_input')
@ac('tab', 'Change the title of the active tab')
def set_tab_title(self) -> None:
@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.'
)
def set_tab_title(self, title: str = '') -> None:
tab = self.active_tab
if tab:
if title:
tab.set_title(title)
return
args = [
'--name=tab-title', '--message', _('Enter the new title for this tab below.'),
'--default', tab.name or tab.title, 'do_set_tab_title', str(tab.id)]

View File

@ -136,7 +136,7 @@ def detach_tab_parse(func: str, rest: str) -> FuncArgsType:
return func, (rest,)
@func_with_args('set_background_opacity', 'goto_layout', 'toggle_layout', 'kitty_shell', 'show_kitty_doc')
@func_with_args('set_background_opacity', 'goto_layout', 'toggle_layout', 'kitty_shell', 'show_kitty_doc', 'set_tab_title')
def simple_parse(func: str, rest: str) -> FuncArgsType:
return func, [rest]