Allow using --match=session:. to match windows in the currently active session
This commit is contained in:
parent
68fdf3f65b
commit
89145e6a55
3 changed files with 8 additions and 2 deletions
|
|
@ -113,7 +113,8 @@ def __call__(self, key: str, opt_name: str | None = None, missing: Any = None) -
|
|||
: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 @@ def __call__(self, key: str, opt_name: str | None = None, missing: Any = None) -
|
|||
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 @@ def matches_query(self, field: str, query: str, active_tab_manager: Optional['Ta
|
|||
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 @@ def matches(self, field: str, pat: MatchPatternType) -> bool:
|
|||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue