Have the semantics of is_focused match that of state:focused otherwise things are liable to get confusing

The previous value is now available as is_active_window
This commit is contained in:
Kovid Goyal
2022-11-03 22:28:37 +05:30
parent c0b11c5656
commit a856c64104
3 changed files with 9 additions and 5 deletions

View File

@@ -138,6 +138,7 @@ def compile_match_query(exp: str, is_simple: bool = True) -> MatchPatternType:
class WindowDict(TypedDict):
id: int
is_focused: bool
is_active_window: bool
title: str
pid: Optional[int]
cwd: str
@@ -614,10 +615,11 @@ class Window:
def __repr__(self) -> str:
return f'Window(title={self.title}, id={self.id})'
def as_dict(self, is_focused: bool = False, is_self: bool = False) -> WindowDict:
def as_dict(self, is_focused: bool = False, is_self: bool = False, is_active_window: bool = False) -> WindowDict:
return dict(
id=self.id,
is_focused=is_focused,
is_active_window=is_active_window,
title=self.title,
pid=self.child.pid,
cwd=self.child.current_cwd or self.child.cwd,