Skip to content

Commit ec65979

Browse files
committed
feat(Window): Aliases, deprecations
1 parent e96a8fd commit ec65979

File tree

1 file changed

+50
-2
lines changed

1 file changed

+50
-2
lines changed

src/libtmux/window.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,25 @@ def attached_pane(self) -> t.Optional["Pane"]:
533533
# Redundant stuff we want to remove
534534
#
535535
def _list_panes(self) -> t.List[PaneDict]:
536+
"""
537+
.. deprecated:: 0.16
538+
"""
536539
return [pane.__dict__ for pane in self.panes]
537540

538541
@property
539542
def _panes(self) -> t.List[PaneDict]:
540-
"""Property / alias to return :meth:`~._list_panes`."""
543+
"""Property / alias to return :meth:`~._list_panes`.
544+
545+
.. deprecated:: 0.16
546+
"""
541547

542548
return self._list_panes()
543549

544550
def list_panes(self) -> t.List["Pane"]:
545-
"""Return list of :class:`Pane` for the window."""
551+
"""Return list of :class:`Pane` for the window.
552+
553+
.. deprecated:: 0.16
554+
"""
546555

547556
return self.panes
548557

@@ -565,3 +574,42 @@ def __repr__(self) -> str:
565574
self.window_name,
566575
self.session,
567576
)
577+
578+
#
579+
# Aliases
580+
#
581+
@property
582+
def id(self) -> str | None:
583+
"""Alias of :attr:`Window.window_id`
584+
585+
>>> window.id
586+
'@1'
587+
588+
>>> window.id == window.window_id
589+
True
590+
"""
591+
return self.window_id
592+
593+
@property
594+
def name(self) -> str | None:
595+
"""Alias of :attr:`Window.window_name`
596+
597+
>>> window.name
598+
'tmux'
599+
600+
>>> window.name == window.window_name
601+
True
602+
"""
603+
return self.window_name
604+
605+
@property
606+
def index(self) -> str | None:
607+
"""Alias of :attr:`Window.window_index`
608+
609+
>>> window.index
610+
'1'
611+
612+
>>> window.index == window.window_index
613+
True
614+
"""
615+
return self.window_index

0 commit comments

Comments
 (0)