mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Better window title when choosing tabs/OS windows
This commit is contained in:
@@ -120,7 +120,7 @@ class Hints(Handler):
|
|||||||
self.all_marks = all_marks
|
self.all_marks = all_marks
|
||||||
self.ignore_mark_indices: Set[int] = set()
|
self.ignore_mark_indices: Set[int] = set()
|
||||||
self.args = args
|
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.multiple = args.multiple
|
||||||
self.match_suffix = self.get_match_suffix(args)
|
self.match_suffix = self.get_match_suffix(args)
|
||||||
self.chosen: List[Mark] = []
|
self.chosen: List[Mark] = []
|
||||||
@@ -634,6 +634,9 @@ on selected matches. See https://sw.kovidgoyal.net/kitty/kittens/hints.html
|
|||||||
for details. You can also specify absolute paths to load the script from elsewhere.
|
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(
|
'''.format(
|
||||||
default_regex=DEFAULT_REGEX,
|
default_regex=DEFAULT_REGEX,
|
||||||
line='{{line}}', path='{{path}}'
|
line='{{line}}', path='{{path}}'
|
||||||
|
|||||||
@@ -1460,7 +1460,8 @@ class Boss:
|
|||||||
target_tab.make_active()
|
target_tab.make_active()
|
||||||
|
|
||||||
def select_tab(self) -> None:
|
def select_tab(self) -> None:
|
||||||
lines = ['Choose a tab to switch to', '']
|
title = 'Choose a tab to switch to'
|
||||||
|
lines = [title, '']
|
||||||
fmt = ': {1}'
|
fmt = ': {1}'
|
||||||
tab_id_map: Dict[int, Optional[Union[str, int]]] = {}
|
tab_id_map: Dict[int, Optional[Union[str, int]]] = {}
|
||||||
current_tab = self.active_tab
|
current_tab = self.active_tab
|
||||||
@@ -1486,7 +1487,7 @@ class Boss:
|
|||||||
self._run_kitten(
|
self._run_kitten(
|
||||||
'hints', args=(
|
'hints', args=(
|
||||||
'--ascending', '--customize-processing=::import::kitty.choose_entry',
|
'--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
|
), input_data='\r\n'.join(lines).encode('utf-8'), custom_callback=done, action_on_removal=done2
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1495,10 +1496,8 @@ class Boss:
|
|||||||
return self._move_window_to(target_os_window_id='new')
|
return self._move_window_to(target_os_window_id='new')
|
||||||
if args[0] == 'new-tab':
|
if args[0] == 'new-tab':
|
||||||
return self._move_window_to(target_tab_id='new')
|
return self._move_window_to(target_tab_id='new')
|
||||||
lines = [
|
title = 'Choose a tab to move the window to'
|
||||||
'Choose a tab to move the window to',
|
lines = [title, '']
|
||||||
''
|
|
||||||
]
|
|
||||||
fmt = ': {1}'
|
fmt = ': {1}'
|
||||||
tab_id_map: Dict[int, Optional[Union[str, int]]] = {}
|
tab_id_map: Dict[int, Optional[Union[str, int]]] = {}
|
||||||
current_tab = self.active_tab
|
current_tab = self.active_tab
|
||||||
@@ -1534,7 +1533,7 @@ class Boss:
|
|||||||
self._run_kitten(
|
self._run_kitten(
|
||||||
'hints', args=(
|
'hints', args=(
|
||||||
'--ascending', '--customize-processing=::import::kitty.choose_entry',
|
'--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
|
), input_data='\r\n'.join(lines).encode('utf-8'), custom_callback=done, action_on_removal=done2
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1542,10 +1541,8 @@ class Boss:
|
|||||||
if not args or args[0] == 'new':
|
if not args or args[0] == 'new':
|
||||||
return self._move_tab_to()
|
return self._move_tab_to()
|
||||||
|
|
||||||
lines = [
|
title = 'Choose an OS window to move the tab to'
|
||||||
'Choose an OS window to move the tab to',
|
lines = [title, '']
|
||||||
''
|
|
||||||
]
|
|
||||||
fmt = ': {1}'
|
fmt = ': {1}'
|
||||||
os_window_id_map: Dict[int, Optional[int]] = {}
|
os_window_id_map: Dict[int, Optional[int]] = {}
|
||||||
current_os_window = getattr(self.active_tab, 'os_window_id', 0)
|
current_os_window = getattr(self.active_tab, 'os_window_id', 0)
|
||||||
@@ -1582,7 +1579,7 @@ class Boss:
|
|||||||
self._run_kitten(
|
self._run_kitten(
|
||||||
'hints', args=(
|
'hints', args=(
|
||||||
'--ascending', '--customize-processing=::import::kitty.choose_entry',
|
'--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
|
), input_data='\r\n'.join(lines).encode('utf-8'), custom_callback=done, action_on_removal=done2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user