mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-10 07:59:24 +02:00
Allow using --match=session:. to match windows in the currently active session
This commit is contained in:
@@ -113,7 +113,8 @@ The field :code:`neighbor` refers to a neighbor of the active window in the spec
|
||||
:code:`left`, :code:`right`, :code:`top` or :code:`bottom`.
|
||||
|
||||
The field :code:`session` matches windows that were created in the specified session.
|
||||
Use the expression :code:`^$` to match windows that were not created in a session.
|
||||
Use the expression :code:`^$` to match windows that were not created in a session and
|
||||
:code:`.` to match the currently active session.
|
||||
|
||||
When using the :code:`env` field to match on environment variables, you can specify only the environment variable name
|
||||
or a name and value, for example, :code:`env:MY_ENV_VAR=2`.
|
||||
@@ -159,7 +160,8 @@ The :code:`recent` number matches recently active tabs in the currently active O
|
||||
active tab, one the previously active tab and so on.
|
||||
|
||||
The field :code:`session` matches tabs that were created in the specified session.
|
||||
Use the expression :code:`^$` to match tabs that were not created in a session.
|
||||
Use the expression :code:`^$` to match tabs that were not created in a session and
|
||||
:code:`.` to match the currently active session.
|
||||
|
||||
When using the :code:`env` field to match on environment variables, you can specify only the environment variable name
|
||||
or a name and value, for example, :code:`env:MY_ENV_VAR=2`. Tabs containing any window with the specified environment
|
||||
|
||||
@@ -957,6 +957,8 @@ class Tab: # {{{
|
||||
return active_tab_manager is not None and self.tab_manager_ref() is active_tab_manager and self.os_window_id == last_focused_os_window_id()
|
||||
return False
|
||||
if field == 'session':
|
||||
if query == '.':
|
||||
return self.created_in_session_name == get_boss().active_session
|
||||
return re.search(query, self.created_in_session_name) is not None
|
||||
return False
|
||||
|
||||
|
||||
@@ -910,6 +910,8 @@ class Window:
|
||||
return True
|
||||
return False
|
||||
if field == 'session':
|
||||
if pat.pattern == '.':
|
||||
return self.created_in_session_name == get_boss().active_session
|
||||
return pat.search(self.created_in_session_name) is not None
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user