Skip to content

Commit 413a676

Browse files
committed
#56 some more notes that you don't need to see the pane,window,session to alter it.
1 parent 3f337ac commit 413a676

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

doc/quickstart_python.rst

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,54 @@ Also, since you are aware of this power, let's commemorate the experience:
307307
308308
You should have noticed :meth:`Window.rename_window` renamed the window.
309309

310+
Moving cursor across windows and panes
311+
--------------------------------------
312+
313+
You have to ways you can move your cursor to new sessions, windows and panes.
314+
315+
For one, arguments such as ``attach=False`` can be omittted.
316+
317+
.. code-block:: python
318+
319+
>>> pane = window.split_window()
320+
321+
This gives you the :class:`Pane` along with moving the cursor to a new window. You
322+
can also use the ``.select_*`` available on the object. In this case, pane has
323+
:meth:`Pane.select_pane()`.
324+
325+
.. code-block:: python
326+
327+
>>> pane = window.split_window(attach=False)
328+
>>> pane.select_pane()
329+
330+
.. note:: There is much, much more. Take a look at the :ref:`API` and the `testsuite`_.
331+
332+
.. todo:: create a ``kill_pane()`` method.
333+
.. todo:: have a ``.kill()`` and ``.select()`` proxy for Server, Session, Window and Pane objects.
334+
335+
Sending commands to tmux panes remotely
336+
---------------------------------------
337+
338+
You may send commands to panes, windows and sessions **without** them being visible.
339+
As long as you have the object, or are iterating through a list of them, you can ``.send_keys``.
340+
341+
.. code-block:: python
342+
343+
>>> window = session.new_window(attach=False, window_name="test")
344+
>>> pane = window.split_window(attach=False)
345+
>>> pane.send_keys('echo hey', enter=False)
346+
347+
See the other window, notice that :meth:`Pane.send_keys` has ``echo hey`` written,
348+
*still in the prompt*.
349+
350+
``enter=False`` can be used to send keys without pressing return. In this case,
351+
you may leave it to the user to press return themselves, or complete a command
352+
using :meth:`Pane.enter()`:
353+
354+
.. code-block:: python
355+
356+
>>> pane.enter()
357+
310358
Final notes
311359
-----------
312360

@@ -322,7 +370,6 @@ sessions in the background. :)
322370
If you want to dig deeper, check out :ref:`API`, the code for
323371
`workspacebuilder.py`_ and our `testsuite`_ (see :ref:`developing`.)
324372

325-
326373
.. _sliderepl: http://discorporate.us/projects/sliderepl/
327374
.. _backbone: http:/ /backbonejs.org
328375
.. _Backbone.Collection.prototype.findWhere: http://backbonejs.org/#Collection-findWhere

0 commit comments

Comments
 (0)