Implement @focus-window
This commit is contained in:
parent
88523b2692
commit
3cd744b247
@ -328,6 +328,27 @@ def new_window(boss, window, payload):
|
||||
return str(w.id)
|
||||
|
||||
|
||||
@cmd(
|
||||
'Focus the specified window',
|
||||
options_spec=MATCH_WINDOW_OPTION
|
||||
)
|
||||
def cmd_focus_window(global_opts, opts, args):
|
||||
return {'match': opts.match}
|
||||
|
||||
|
||||
def focus_window(boss, window, payload):
|
||||
windows = [window or boss.active_window]
|
||||
match = payload['match']
|
||||
if match:
|
||||
windows = tuple(boss.match_windows(match))
|
||||
if not windows:
|
||||
raise ValueError('No matching windows for expression: {}'.format(match))
|
||||
for window in windows:
|
||||
if window:
|
||||
boss.set_active_window(window)
|
||||
break
|
||||
|
||||
|
||||
@cmd(
|
||||
'Get text from the specified window',
|
||||
options_spec=MATCH_WINDOW_OPTION + '''\n
|
||||
|
||||
@ -35,7 +35,7 @@ another window, for example:
|
||||
|
||||
This will show the output of ls in the output window instead of the current
|
||||
window. You can use this technique to, for example, show the output of running
|
||||
make in your editor in a different window. The possibilities are endless.
|
||||
`make` in your editor in a different window. The possibilities are endless.
|
||||
|
||||
You can even have things you type show up in a different window. Run:
|
||||
|
||||
@ -57,6 +57,10 @@ Let's change the title of the current tab:
|
||||
|
||||
kitty @ set-tab-title Master Tab
|
||||
|
||||
Now lets switch to the newly opened tab.
|
||||
|
||||
kitty @ focus-window --match title:New
|
||||
|
||||
You can get a listing of available tabs and windows, by running:
|
||||
|
||||
kitty @ ls
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user