mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-13 12:08:45 +02:00
A mappable action to visually select the window to focus with the keyboard
This commit is contained in:
@@ -6,9 +6,7 @@ import weakref
|
||||
from collections import deque
|
||||
from contextlib import suppress
|
||||
from itertools import count
|
||||
from typing import (
|
||||
Any, Deque, Dict, Generator, Iterator, List, Optional, Tuple, Union
|
||||
)
|
||||
from typing import Any, Deque, Dict, Iterator, List, Optional, Tuple, Union
|
||||
|
||||
from .types import WindowGeometry
|
||||
from .typing import EdgeLiteral, TabType, WindowType
|
||||
@@ -202,7 +200,7 @@ class WindowList:
|
||||
def change_tab(self, tab: TabType) -> None:
|
||||
self.tabref = weakref.ref(tab)
|
||||
|
||||
def iter_windows_with_visibility(self) -> Generator[Tuple[WindowType, bool], None, None]:
|
||||
def iter_windows_with_visibility(self) -> Iterator[Tuple[WindowType, bool]]:
|
||||
for g in self.groups:
|
||||
aw = g.active_window_id
|
||||
for window in g:
|
||||
@@ -211,6 +209,16 @@ class WindowList:
|
||||
def iter_all_layoutable_groups(self, only_visible: bool = False) -> Iterator[WindowGroup]:
|
||||
return iter(g for g in self.groups if g.is_visible_in_layout) if only_visible else iter(self.groups)
|
||||
|
||||
def iter_visible_windows_with_number(self) -> Iterator[Tuple[int, WindowType]]:
|
||||
for i, g in enumerate(self.groups):
|
||||
if g.is_visible_in_layout:
|
||||
aw = g.active_window_id
|
||||
for window in g:
|
||||
if window in g:
|
||||
if window.id == aw:
|
||||
yield i, window
|
||||
break
|
||||
|
||||
def make_previous_group_active(self, which: int = 1, notify: bool = True) -> None:
|
||||
which = max(1, which)
|
||||
gid_map = {g.id: i for i, g in enumerate(self.groups)}
|
||||
|
||||
Reference in New Issue
Block a user