@@ -686,15 +686,37 @@ def move_window(
686686 #
687687 # Climbers
688688 #
689- def select_window (self ) -> "Window" :
689+ def select (self ) -> "Window" :
690690 """Select window.
691691
692692 To select a window object asynchrously. If a ``window`` object exists
693- and is no longer longer the current window, ``w.select_window()``
693+ and is no longer the current window, ``w.select_window()``
694694 will make ``w`` the current window.
695+
696+ Examples
697+ --------
698+ >>> window = session.attached_window
699+ >>> new_window = session.new_window()
700+ >>> session.refresh()
701+ >>> active_windows = [w for w in session.windows if w.window_active == '1']
702+
703+ >>> new_window.window_active == '1'
704+ False
705+
706+ >>> new_window.select()
707+ Window(...)
708+
709+ >>> new_window.window_active == '1'
710+ True
695711 """
696- assert isinstance (self .window_index , str )
697- return self .session .select_window (self .window_index )
712+ proc = self .cmd ("select-window" )
713+
714+ if proc .stderr :
715+ raise exc .LibTmuxException (proc .stderr )
716+
717+ self .refresh ()
718+
719+ return self
698720
699721 #
700722 # Computed properties
@@ -792,6 +814,23 @@ def width(self) -> t.Optional[str]:
792814 #
793815 # Legacy: Redundant stuff we want to remove
794816 #
817+ def select_window (self ) -> "Window" :
818+ """Select window.
819+
820+ Notes
821+ -----
822+ .. deprecated:: 0.30
823+
824+ Deprecated in favor of :meth:`.select()`.
825+ """
826+ warnings .warn (
827+ "Window.select_window() is deprecated in favor of Window.select()" ,
828+ category = DeprecationWarning ,
829+ stacklevel = 2 ,
830+ )
831+ assert isinstance (self .window_index , str )
832+ return self .session .select_window (self .window_index )
833+
795834 def kill_window (self ) -> None :
796835 """Kill the current :class:`Window` object. ``$ tmux kill-window``.
797836
0 commit comments