Skip to content

Commit 88954e8

Browse files
committed
feat(Window): Aliases
1 parent e96a8fd commit 88954e8

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

src/libtmux/window.py

+39
Original file line numberDiff line numberDiff line change
@@ -565,3 +565,42 @@ def __repr__(self) -> str:
565565
self.window_name,
566566
self.session,
567567
)
568+
569+
#
570+
# Aliases
571+
#
572+
@property
573+
def id(self) -> str | None:
574+
"""Alias of :attr:`Window.id`
575+
576+
>>> window.id
577+
'@1'
578+
579+
>>> window.id == window.window_id
580+
True
581+
"""
582+
return self.window_id
583+
584+
@property
585+
def name(self) -> str | None:
586+
"""Alias of :attr:`Window.name`
587+
588+
>>> window.name
589+
'tmux'
590+
591+
>>> window.name == window.window_name
592+
True
593+
"""
594+
return self.window_name
595+
596+
@property
597+
def index(self) -> str | None:
598+
"""Alias of :attr:`Window.index`
599+
600+
>>> window.index
601+
'1'
602+
603+
>>> window.index == window.window_index
604+
True
605+
"""
606+
return self.window_index

0 commit comments

Comments
 (0)