mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 03:01:57 +02:00
Add window_id and window_title fields to --match-tab
This commit is contained in:
@@ -280,6 +280,13 @@ class Boss:
|
|||||||
if tab.matches(field, pat):
|
if tab.matches(field, pat):
|
||||||
yield tab
|
yield tab
|
||||||
found = True
|
found = True
|
||||||
|
elif field in ('window_id', 'window_title'):
|
||||||
|
wf = field.split('_')[1]
|
||||||
|
tabs = {self.tab_for_window(w) for w in self.match_windows(f'{wf}:{exp}')}
|
||||||
|
for q in tabs:
|
||||||
|
if q:
|
||||||
|
found = True
|
||||||
|
yield q
|
||||||
if not found:
|
if not found:
|
||||||
tabs = {self.tab_for_window(w) for w in self.match_windows(match)}
|
tabs = {self.tab_for_window(w) for w in self.match_windows(match)}
|
||||||
for q in tabs:
|
for q in tabs:
|
||||||
|
|||||||
@@ -89,12 +89,14 @@ and value, for example, :italic:`env:MY_ENV_VAR=2`
|
|||||||
MATCH_TAB_OPTION = '''\
|
MATCH_TAB_OPTION = '''\
|
||||||
--match -m
|
--match -m
|
||||||
The tab to match. Match specifications are of the form:
|
The tab to match. Match specifications are of the form:
|
||||||
:italic:`field:regexp`. Where field can be one of: id, title, pid, cwd, env, cmdline.
|
:italic:`field:regexp`. Where field can be one of:
|
||||||
|
id, title, window_id, window_title, pid, cwd, env, cmdline.
|
||||||
You can use the :italic:`ls` command to get a list of tabs. Note that for
|
You can use the :italic:`ls` command to get a list of tabs. Note that for
|
||||||
numeric fields such as id and pid the expression is interpreted as a number,
|
numeric fields such as id and pid the expression is interpreted as a number,
|
||||||
not a regular expression. When using title or id, first a matching tab is
|
not a regular expression. When using title or id, first a matching tab is
|
||||||
looked for and if not found a matching window is looked for, and the tab
|
looked for and if not found a matching window is looked for, and the tab
|
||||||
for that window is used.
|
for that window is used. You can also use window_id and window_title to match
|
||||||
|
the tab that contains the window with the specified id or title.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user