@@ -53,8 +53,8 @@ Connect to a live tmux session:
53
53
54
54
``` python
55
55
>> > import libtmux
56
- >> > s = libtmux.Server()
57
- >> > s
56
+ >> > svr = libtmux.Server()
57
+ >> > svr
58
58
Server(socket_path = / tmp/ tmux- ... / default)
59
59
```
60
60
@@ -66,6 +66,49 @@ current tmux server / session / window pane.
66
66
[ ptpython ] : https://github.com/prompt-toolkit/ptpython
67
67
[ ipython ] : https://ipython.org/
68
68
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
+
69
112
List sessions:
70
113
71
114
``` python
0 commit comments