mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-22 16:28:19 +02:00
Allow specifying a title for @ select-window
This commit is contained in:
@@ -9,7 +9,7 @@ from .base import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from kitty.cli_stub import LaunchRCOptions as CLIOptions
|
from kitty.cli_stub import SelectWindowRCOptions as CLIOptions
|
||||||
from kitty.tabs import Tab
|
from kitty.tabs import Tab
|
||||||
|
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ class SelectWindow(RemoteCommand):
|
|||||||
'''
|
'''
|
||||||
match: The tab to open the new window in
|
match: The tab to open the new window in
|
||||||
self: Boolean, if True use tab the command was run in
|
self: Boolean, if True use tab the command was run in
|
||||||
|
title: A title for this selection
|
||||||
'''
|
'''
|
||||||
|
|
||||||
short_desc = 'Visually select a window in the specified tab'
|
short_desc = 'Visually select a window in the specified tab'
|
||||||
@@ -36,11 +37,15 @@ The time in seconds to wait for the user to select a window.
|
|||||||
type=bool-set
|
type=bool-set
|
||||||
If specified the tab containing the window this command is run in is used
|
If specified the tab containing the window this command is run in is used
|
||||||
instead of the active tab.
|
instead of the active tab.
|
||||||
|
|
||||||
|
|
||||||
|
--title
|
||||||
|
A title that will be displayed to the user to describe what this selection is for
|
||||||
'''
|
'''
|
||||||
is_asynchronous = True
|
is_asynchronous = True
|
||||||
|
|
||||||
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
|
def message_to_kitty(self, global_opts: RCOptions, opts: 'CLIOptions', args: ArgsType) -> PayloadType:
|
||||||
ans = {'self': opts.self, 'match': opts.match}
|
ans = {'self': opts.self, 'match': opts.match, 'title': opts.title}
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
|
def response_from_kitty(self, boss: Boss, window: Optional[Window], payload_get: PayloadGetType) -> ResponseType:
|
||||||
@@ -53,7 +58,7 @@ instead of the active tab.
|
|||||||
responder.send_error('No window selected')
|
responder.send_error('No window selected')
|
||||||
for tab in self.tabs_for_match_payload(boss, window, payload_get):
|
for tab in self.tabs_for_match_payload(boss, window, payload_get):
|
||||||
if tab:
|
if tab:
|
||||||
boss.visual_window_select_action(tab, callback, 'Choose window')
|
boss.visual_window_select_action(tab, callback, payload_get('title') or 'Choose window')
|
||||||
break
|
break
|
||||||
return no_response
|
return no_response
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user