Welcome to thonmux’s documentation!

The thonmux library was designed to be a Python API to interact with tmux in a pythonic way.

Supported commands

  • attach-session - thonmux.Thonmux.attach_session()
  • kill-pane - thonmux.Thonmux.kill_pane()
  • kill-window - thonmux.Thonmux.kill_window()
  • last-window - thonmux.Thonmux.last_window()
  • new-session - thonmux.Thonmux.new_session()
  • new-window - thonmux.Thonmux.new_window()
  • next-window - thonmux.Thonmux.next_window()
  • previous-window - thonmux.Thonmux.previous_window()
  • rename-session - thonmux.Thonmux.rename_session()
  • rename-window - thonmux.Thonmux.rename_window()
  • resize-pane - thonmux.Thonmux.resize_pane()
  • select-pane - thonmux.Thonmux.select_pane()
  • select-window - thonmux.Thonmux.select_window()
  • send-keys - thonmux.Thonmux.send_keys()
  • split-window - thonmux.Thonmux.split_window()

There’s also a few convenience commands:

  • next-pane - thonmux.Thonmux.next_pane() (selects the next pane under

    the tracked window)

  • previous-pane - thonmux.Thonmux.previous_pane() (selects the previous

    pane under the tracked window)

  • toggle-zoom - thonmux.Thonmux.toggle_zoom() (zooms in/out of the

    tracked pane)

Quickstart

>>> from thonmux import Thonmux
>>> t = Thonmux()
>>> t.new_session('new-session', dettached=False)
>>> t.session
    Session(name=new-session, creation=2015-06-07 18:43:20, attached=True)
>>> t.new_window('new-window')
>>> t.session.windows
[Window(index=0, name=zsh, dimensions=[159x42], active=False), Window(index=1, name=new-window, dimensions=[159x42], active=True)]
>>> t.window
Window(index=1, name=new-window, dimensions=[159x42], active=True)
>>> t.rename_window('renamed-window')
>>> t.window
Window(index=1, name=renamed-window, dimensions=[159x42], active=True)
>>> t.session.windows
[Window(index=0, name=zsh, dimensions=[159x42], active=False), Window(index=1, name=renamed-window, dimensions=[159x42], active=True)]
>>> t.split_window()
>>> t.pane
Pane(index=1, dimensions=[159x20], active=True)
>>> t.send_keys('ls -la | grep .py')
...

Installation

$ pip install thonmux

FAQ

  1. Why use thonmux?
    • thonmux makes things pythonic.
  2. Why not use something else, like tmuxp?
    • tmuxp is a good project but sometimes it doesn’t attend to my expectations.
  3. How can I help?
  4. I found a bug, what do I do?

Contents:

Indices and tables