@@ -53,8 +53,8 @@ Connect to a live tmux session:
5353
5454``` python
5555>> > import libtmux
56- >> > s = libtmux.Server()
57- >> > s
56+ >> > svr = libtmux.Server()
57+ >> > svr
5858Server(socket_path = / tmp/ tmux- ... / default)
5959```
6060
@@ -66,6 +66,49 @@ current tmux server / session / window pane.
6666[ ptpython ] : https://github.com/prompt-toolkit/ptpython
6767[ ipython ] : https://ipython.org/
6868
69+ Run any tmux command, respective of context:
70+
71+ Honors tmux socket name and path:
72+
73+ ``` python
74+ >> > server = Server(socket_name = ' libtmux_doctest' )
75+ >> > server.cmd(' display-message' , ' hello world' )
76+ < libtmux... >
77+ ```
78+
79+ New session:
80+
81+ ``` python
82+ >> > server.cmd(' new-session' , ' -d' , ' -P' , ' -F#{session_id} ' ).stdout[0 ]
83+ ' $2'
84+ ```
85+
86+ ``` python
87+ >> > session.cmd(' new-window' , ' -P' ).stdout[0 ]
88+ ' libtmux...:2.0'
89+ ```
90+
91+ Time for some tech, direct to a rich, ` Window ` object:
92+
93+ ``` python
94+ >> > Window.from_window_id(window_id = session.cmd(' new-window' , ' -P' , ' -F#{window_id} ' ).stdout[0 ], server = session.server)
95+ Window(@ 2 2 :... , Session($ 1 libtmux_... ))
96+ ```
97+
98+ Create a pane from a window:
99+
100+ ``` python
101+ >> > window.cmd(' split-window' , ' -P' , ' -F#{pane_id} ' ).stdout[0 ]
102+ ' %2'
103+ ```
104+
105+ Magic, directly to a ` Pane ` :
106+
107+ ``` python
108+ >> > Pane.from_pane_id(pane_id = session.cmd(' split-window' , ' -P' , ' -F#{pane_id} ' ).stdout[0 ], server = session.server)
109+ Pane(% ... Window(@ 1 1 :... , Session($ 1 libtmux_... )))
110+ ```
111+
69112List sessions:
70113
71114``` python
0 commit comments