Better window title when choosing tabs/OS windows
This commit is contained in:
parent
6409786f8d
commit
ff96036f62
2 changed files with 13 additions and 13 deletions
|
|
@ -120,7 +120,7 @@ def __init__(self, text: str, all_marks: Sequence[Mark], index_map: Dict[int, Ma
|
|||
self.all_marks = all_marks
|
||||
self.ignore_mark_indices: Set[int] = set()
|
||||
self.args = args
|
||||
self.window_title = _('Choose URL') if args.type == 'url' else _('Choose text')
|
||||
self.window_title = args.window_title or (_('Choose URL') if args.type == 'url' else _('Choose text'))
|
||||
self.multiple = args.multiple
|
||||
self.match_suffix = self.get_match_suffix(args)
|
||||
self.chosen: List[Mark] = []
|
||||
|
|
@ -634,6 +634,9 @@ def run(args: HintsCLIOptions, text: str, extra_cli_args: Sequence[str] = ()) ->
|
|||
for details. You can also specify absolute paths to load the script from elsewhere.
|
||||
|
||||
|
||||
--window-title
|
||||
The window title for the hints window, default title is selected based on
|
||||
the type of text being hinted.
|
||||
'''.format(
|
||||
default_regex=DEFAULT_REGEX,
|
||||
line='{{line}}', path='{{path}}'
|
||||
|
|
|
|||
|
|
@ -1460,7 +1460,8 @@ def _move_tab_to(self, tab: Optional[Tab] = None, target_os_window_id: Optional[
|
|||
target_tab.make_active()
|
||||
|
||||
def select_tab(self) -> None:
|
||||
lines = ['Choose a tab to switch to', '']
|
||||
title = 'Choose a tab to switch to'
|
||||
lines = [title, '']
|
||||
fmt = ': {1}'
|
||||
tab_id_map: Dict[int, Optional[Union[str, int]]] = {}
|
||||
current_tab = self.active_tab
|
||||
|
|
@ -1486,7 +1487,7 @@ def done2(target_window_id: int, self: Boss) -> None:
|
|||
self._run_kitten(
|
||||
'hints', args=(
|
||||
'--ascending', '--customize-processing=::import::kitty.choose_entry',
|
||||
r'--regex=(?m)^:\s+.+$',
|
||||
r'--regex=(?m)^:\s+.+$', '--window-title', title,
|
||||
), input_data='\r\n'.join(lines).encode('utf-8'), custom_callback=done, action_on_removal=done2
|
||||
)
|
||||
|
||||
|
|
@ -1495,10 +1496,8 @@ def detach_window(self, *args: str) -> None:
|
|||
return self._move_window_to(target_os_window_id='new')
|
||||
if args[0] == 'new-tab':
|
||||
return self._move_window_to(target_tab_id='new')
|
||||
lines = [
|
||||
'Choose a tab to move the window to',
|
||||
''
|
||||
]
|
||||
title = 'Choose a tab to move the window to'
|
||||
lines = [title, '']
|
||||
fmt = ': {1}'
|
||||
tab_id_map: Dict[int, Optional[Union[str, int]]] = {}
|
||||
current_tab = self.active_tab
|
||||
|
|
@ -1534,7 +1533,7 @@ def done2(target_window_id: int, self: Boss) -> None:
|
|||
self._run_kitten(
|
||||
'hints', args=(
|
||||
'--ascending', '--customize-processing=::import::kitty.choose_entry',
|
||||
r'--regex=(?m)^:\s+.+$',
|
||||
r'--regex=(?m)^:\s+.+$', '--window-title', title,
|
||||
), input_data='\r\n'.join(lines).encode('utf-8'), custom_callback=done, action_on_removal=done2
|
||||
)
|
||||
|
||||
|
|
@ -1542,10 +1541,8 @@ def detach_tab(self, *args: str) -> None:
|
|||
if not args or args[0] == 'new':
|
||||
return self._move_tab_to()
|
||||
|
||||
lines = [
|
||||
'Choose an OS window to move the tab to',
|
||||
''
|
||||
]
|
||||
title = 'Choose an OS window to move the tab to'
|
||||
lines = [title, '']
|
||||
fmt = ': {1}'
|
||||
os_window_id_map: Dict[int, Optional[int]] = {}
|
||||
current_os_window = getattr(self.active_tab, 'os_window_id', 0)
|
||||
|
|
@ -1582,7 +1579,7 @@ def done2(target_window_id: int, self: Boss) -> None:
|
|||
self._run_kitten(
|
||||
'hints', args=(
|
||||
'--ascending', '--customize-processing=::import::kitty.choose_entry',
|
||||
r'--regex=(?m)^:\s+.+$',
|
||||
r'--regex=(?m)^:\s+.+$', '--window-title', title,
|
||||
), input_data='\r\n'.join(lines).encode('utf-8'), custom_callback=done, action_on_removal=done2
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue