diff --git a/docs/changelog.rst b/docs/changelog.rst index de1a302c2..0cab22ad2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kitty/rc/base.py b/kitty/rc/base.py index 4cbede49d..6b71ef171 100644 --- a/kitty/rc/base.py +++ b/kitty/rc/base.py @@ -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 ` command to get a list of windows. ''' diff --git a/kitty/window.py b/kitty/window.py index 3c4e92b78..eaf108717 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -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':