@@ -25,9 +25,11 @@ install
2525 open a tmux session
2626-------------------
2727
28+ session name ``foo ``, window name ``bar ``
29+
2830.. code-block :: sh
2931
30- $ tmux new-session -n libtmux_wins -s a_libtmux_session
32+ $ tmux new-session -s foo -n bar
3133
3234 pilot your tmux session via python
3335----------------------------------
@@ -50,43 +52,47 @@ pilot your tmux session via python
5052 list sessions::
5153
5254 >>> server.list_sessions()
53- [Session($3 a_libtmux_session ), Session($1 libtmux)]
55+ [Session($3 foo ), Session($1 libtmux)]
5456
5557find session::
5658
5759 >>> server.getById('$3')
58- Session($3 a_libtmux_session )
60+ Session($3 foo )
5961
6062find session by dict lookup::
6163
62- >>> server.findWhere({ "session_name": "a_libtmux_session " })
63- Session($3 a_libtmux_session )
64+ >>> server.findWhere({ "session_name": "foo " })
65+ Session($3 foo )
6466
6567assign session to ``session ``::
6668
67- >>> session = server.findWhere({ "session_name": "a_libtmux_session " })
69+ >>> session = server.findWhere({ "session_name": "foo " })
6870
6971play with session::
7072
7173 >>> session.new_window(attach=False, window_name="ha in the bg")
72- Window(@8 2:ha in the bg, Session($3 a_libtmux_session ))
74+ Window(@8 2:ha in the bg, Session($3 foo ))
7375 >>> session.kill_window("ha in")
74- >>> session.new_window(attach=False, window_name="ha in the bg")
75- Window(@11 3:ha in the bg, Session($3 a_libtmux_session))
76- >>> session.kill_window('@12')
77- >>> window = session.new_window(attach=False, window_name="check this out")
78- >>> window.kill_window()
76+
77+ create new window in the background (don't switch to it):
78+
79+ >>> w = session.new_window(attach = False , window_name = " ha in the bg" )
80+ Window(@11 3:ha in the bg, Session($3 foo))
81+
82+ kill window object directly:
83+
84+ >>> w.kill_window()
7985
8086grab remaining tmux window::
8187
8288 >>> window = session.attached_window()
8389 >>> window.split_window(attach=False)
84- Pane(%23 Window(@10 1:libtmux_wins , Session($3 a_libtmux_session )))
90+ Pane(%23 Window(@10 1:bar , Session($3 foo )))
8591
8692rename window::
8793
8894 >>> window.rename_window('libtmuxower')
89- Window(@10 1:libtmuxower, Session($3 a_libtmux_session ))
95+ Window(@10 1:libtmuxower, Session($3 foo ))
9096
9197create panes by splitting window::
9298
@@ -103,12 +109,27 @@ send key strokes to panes::
103109 >>> pane.send_keys('echo hey', enter=False)
104110 >>> pane.enter()
105111
112+ grab the output of pane::
113+
114+ >>> pane.clear() # clear the pane
115+ >>> pane.send_keys('cowsay hello')
116+ >>> print('\n'.join(pane.cmd('capture-pane', '-p').stdout))
117+ sh-3.2$ cowsay 'hello'
118+ _______
119+ < hello >
120+ -------
121+ \ ^__^
122+ \ (oo)\_______
123+ (__)\ )\/\
124+ ||----w |
125+ || ||
126+
106127powerful traversal features::
107128
108129 >>> pane.window
109- Window(@10 1:libtmuxower, Session($3 a_libtmux_session ))
130+ Window(@10 1:libtmuxower, Session($3 foo ))
110131 >>> pane.window.session
111- Session($3 a_libtmux_session )
132+ Session($3 foo )
112133
113134Project details
114135---------------
0 commit comments