File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,31 @@ $ pip install --user --upgrade --pre libtmux
19
19
20
20
### Features
21
21
22
+ #### Context Managers for tmux Objects
23
+
24
+ Added context manager support for all main tmux objects:
25
+
26
+ - ` Server ` : Automatically kills the server when exiting the context
27
+ - ` Session ` : Automatically kills the session when exiting the context
28
+ - ` Window ` : Automatically kills the window when exiting the context
29
+ - ` Pane ` : Automatically kills the pane when exiting the context
30
+
31
+ Example usage:
32
+
33
+ ``` python
34
+ with Server() as server:
35
+ with server.new_session() as session:
36
+ with session.new_window() as window:
37
+ with window.split() as pane:
38
+ pane.send_keys(' echo "Hello"' )
39
+ # Do work with the pane
40
+ # Everything is cleaned up automatically when exiting contexts
41
+ ```
42
+
43
+ This makes it easier to write clean, safe code that properly cleans up tmux resources.
44
+
45
+ #### Server Initialization Callbacks
46
+
22
47
Server now accepts 2 new optional params, ` socket_name_factory ` and ` on_init ` callbacks (#565 ):
23
48
24
49
- ` socket_name_factory ` : Callable that generates unique socket names for new servers
You can’t perform that action at this time.
0 commit comments