TabGroup¶
Provides a class that represents an iTerm2 tab group.
- class TabGroup(connection, group_id: str, name: str, color: Color | None, collapsed: bool)¶
Represents a tab group.
A tab group is a named, colored collection of adjacent tabs in a window. Its members are always kept consecutive in the tab bar: iTerm2 reorders tabs as needed to maintain that invariant when membership changes.
Don’t create this yourself. Instead, get one from
iterm2.Tab.tab_grouporiterm2.Window.tab_groups, or create one withiterm2.Window.async_create_tab_group().The name, color, and collapsed values reflect the state at the time this object was fetched. After a mutation, re-fetch the app to observe the updated state.
- async async_set_collapsed(collapsed: bool) bool¶
Collapses or expands the group.
Collapsing hides the group’s members in the tab bar. It can be refused when the group comprises the entire window (there would be no tab left to select), in which case this returns False.
- Return type:
bool- Parameters:
collapsed (
bool) – True to collapse, False to expand.- Returns:
The group’s collapsed state after the change.
- Throws:
RPCExceptionif something goes wrong.
- async async_set_color(color: Color) None¶
Changes the group’s color. The new color applies to every member tab.
- Parameters:
color (
Color) – The new color.- Throws:
RPCExceptionif something goes wrong.
- async async_set_name(name: str) None¶
Renames the group. The new name applies to every member tab.
- Parameters:
name (
str) – The new name.- Throws:
RPCExceptionif something goes wrong.
- property collapsed: bool¶
- Returns:
Whether the group is collapsed (its members hidden in the tab bar).
