File tree Expand file tree Collapse file tree 1 file changed +23
-9
lines changed Expand file tree Collapse file tree 1 file changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -130,30 +130,44 @@ Direct lookup:
130130Session($ 1 ... )
131131```
132132
133- Find session by dict lookup :
133+ Filter sesions :
134134
135135``` python
136136>> > server.sessions[0 ].rename_session(' foo' )
137137Session($ 1 foo)
138- >> > server.sessions.filter(session_name = " foo" )[0 ]
138+ >> > server.sessions.filter(session_name = " foo" )
139+ [Session($ 1 foo)]
140+ >> > server.sessions.get(session_name = " foo" )
139141Session($ 1 foo)
140142```
141143
142144Control your session:
143145
144146``` python
145- >> > session.rename_session( ' foo ' )
146- Session($ 1 foo )
147- >> > session.new_window( attach = False , window_name = " ha in the bg " )
148- Window( @ 2 2 :ha in the bg, Session( $ 1 foo) )
149- >> > session.kill_window( " ha in " )
147+ >> > session
148+ Session($ 1 ... )
149+
150+ >> > session.rename_session( ' my-session ' )
151+ Session( $ 1 my - session )
150152```
151153
152154Create new window in the background (don't switch to it):
153155
154156``` python
155- >> > session.new_window(attach = False , window_name = " ha in the bg" )
156- Window(@ 2 2 :ha in the bg, Session($ 1 ... ))
157+ >> > bg_window = session.new_window(attach = False , window_name = " ha in the bg" )
158+ >> > bg_window
159+ Window(@ ... 2 :ha in the bg, Session($ 1 ... ))
160+
161+ # Session can search the window
162+ >> > session.windows.filter(window_name__startswith = " ha" )
163+ [Window(@ ... 2 :ha in the bg, Session($ 1 ... ))]
164+
165+ # Directly
166+ >> > session.windows.get(window_name__startswith = " ha" )
167+ Window(@ ... 2 :ha in the bg, Session($ 1 ... ))
168+
169+ # Clean up
170+ >> > bg_window.kill()
157171```
158172
159173Close window:
You can’t perform that action at this time.
0 commit comments