Add a new mappable action nth_os_window to focus OS window

This commit is contained in:
pagedown
2021-12-04 20:45:01 +08:00
parent 0456399ce5
commit 1f3d86a434
3 changed files with 11 additions and 1 deletions

View File

@@ -1183,6 +1183,13 @@ class Boss:
text = '\n'.join(parse_uri_list(text))
w.paste(text)
@ac('win', 'Focus the nth OS window')
def nth_os_window(self, num: int = 1) -> None:
if self.os_window_map and num > 0:
ids = list(self.os_window_map.keys())
os_window_id = ids[min(num, len(ids)) - 1]
focus_os_window(os_window_id, True)
@ac('win', 'Close the currently active OS Window')
def close_os_window(self) -> None:
tm = self.active_tab_manager

View File

@@ -250,7 +250,7 @@ def remote_control(func: str, rest: str) -> FuncArgsType:
return func, args
@func_with_args('nth_window', 'scroll_to_prompt', 'visual_window_select_action_trigger')
@func_with_args('nth_os_window', 'nth_window', 'scroll_to_prompt', 'visual_window_select_action_trigger')
def single_integer_arg(func: str, rest: str) -> FuncArgsType:
try:
num = int(rest)