add state:focused_os_window to match window

This commit is contained in:
Jackie Li
2025-10-27 08:22:53 +00:00
parent 5e366cb5a3
commit ae29085e5c
3 changed files with 14 additions and 8 deletions

View File

@@ -193,6 +193,9 @@ Detailed list of changes
for saving session files with relative paths, useful when the current working
directory is not the desired location (:doc:`sessions`)
- Add ``state:focused_os_window`` match query to select all windows in the
currently focused OS window (:ref:`search_syntax`)
0.43.1 [2025-10-01]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -124,14 +124,15 @@ as with the :code:`env` field.
The field :code:`state` matches on the state of the window. Supported states
are: :code:`active`, :code:`focused`, :code:`needs_attention`,
:code:`parent_active`, :code:`parent_focused`, :code:`self`,
:code:`overlay_parent`. Active windows are the windows that are active in
their parent tab. There is only one focused window and it is the window to
which keyboard events are delivered. If no window is focused, the last focused
window is matched. The value :code:`self` matches the window in which the
remote control command is run. The value :code:`overlay_parent` matches the
window that is under the :code:`self` window, when the self window is an
overlay.
:code:`parent_active`, :code:`parent_focused`, :code:`focused_os_window`,
:code:`self`, :code:`overlay_parent`. Active windows are the windows that are
active in their parent tab. There is only one focused window and it is the
window to which keyboard events are delivered. If no window is focused, the
last focused window is matched. The value :code:`focused_os_window` matches
all windows in the currently focused OS window. The value :code:`self` matches
the window in which the remote control command is run. The value
:code:`overlay_parent` matches the window that is under the :code:`self`
window, when the self window is an overlay.
Note that you can use the :ref:`kitten @ ls <at-ls>` command to get a list of windows.
'''

View File

@@ -903,6 +903,8 @@ class Window:
return False
if query == 'parent_focused':
return active_tab is not None and self.tabref() is active_tab and last_focused_os_window_id() == self.os_window_id
if query == 'focused_os_window':
return last_focused_os_window_id() == self.os_window_id
if query == 'self':
return self is self_window
if query == 'overlay_parent':