| 1 | (api)= |
| 2 | |
| 3 | (reference)= |
| 4 | |
| 5 | # API Reference |
| 6 | |
| 7 | libtmux's public API mirrors tmux's object hierarchy: |
| 8 | {class}`~libtmux.Server` → {class}`~libtmux.Session` → |
| 9 | {class}`~libtmux.Window` → {class}`~libtmux.Pane`. Attached terminals show up as |
| 10 | {class}`~libtmux.Client` objects accessed off the server. |
| 11 | |
| 12 | ## What do you want to do? |
| 13 | |
| 14 | ::::{grid} 1 2 2 2 |
| 15 | :gutter: 2 |
| 16 | |
| 17 | :::{grid-item-card} Find a session, window, or pane? |
| 18 | :link: libtmux.server |
| 19 | :link-type: doc |
| 20 | Use {meth}`server.sessions.get() <libtmux._internal.query_list.QueryList.get>`, |
| 21 | {meth}`session.windows.get() <libtmux._internal.query_list.QueryList.get>`. |
| 22 | ::: |
| 23 | |
| 24 | :::{grid-item-card} Send commands or keys to a terminal? |
| 25 | :link: libtmux.pane |
| 26 | :link-type: doc |
| 27 | Use {meth}`pane.send_keys() <libtmux.Pane.send_keys>` and |
| 28 | {meth}`pane.enter() <libtmux.Pane.enter>`. |
| 29 | ::: |
| 30 | |
| 31 | :::{grid-item-card} Capture output from a pane? |
| 32 | :link: libtmux.pane |
| 33 | :link-type: doc |
| 34 | Use {meth}`pane.capture_pane() <libtmux.Pane.capture_pane>`. |
| 35 | ::: |
| 36 | |
| 37 | :::{grid-item-card} Write tests against tmux? |
| 38 | :link: testing/index |
| 39 | :link-type: doc |
| 40 | Use the {doc}`pytest plugin <testing/pytest-plugin/index>` and test helpers. |
| 41 | ::: |
| 42 | |
| 43 | :::: |
| 44 | |
| 45 | ## Core Objects |
| 46 | |
| 47 | ::::{grid} 1 1 2 2 |
| 48 | :gutter: 2 2 3 3 |
| 49 | |
| 50 | :::{grid-item-card} Server |
| 51 | :link: libtmux.server |
| 52 | :link-type: doc |
| 53 | Entry point. Manages sessions and executes raw tmux commands. |
| 54 | ::: |
| 55 | |
| 56 | :::{grid-item-card} Session |
| 57 | :link: libtmux.session |
| 58 | :link-type: doc |
| 59 | Manages windows within a tmux session. |
| 60 | ::: |
| 61 | |
| 62 | :::{grid-item-card} Window |
| 63 | :link: libtmux.window |
| 64 | :link-type: doc |
| 65 | Manages panes, layouts, and window operations. |
| 66 | ::: |
| 67 | |
| 68 | :::{grid-item-card} Pane |
| 69 | :link: libtmux.pane |
| 70 | :link-type: doc |
| 71 | Terminal instance. Send keys and capture output. |
| 72 | ::: |
| 73 | |
| 74 | :::{grid-item-card} Client |
| 75 | :link: libtmux.client |
| 76 | :link-type: doc |
| 77 | Attached terminal. Read read-only state, theme, termtype. |
| 78 | ::: |
| 79 | |
| 80 | :::: |
| 81 | |
| 82 | ## Supporting Modules |
| 83 | |
| 84 | ::::{grid} 1 2 3 3 |
| 85 | :gutter: 2 2 3 3 |
| 86 | |
| 87 | :::{grid-item-card} Common |
| 88 | :link: libtmux.common |
| 89 | :link-type: doc |
| 90 | Base classes and command execution. |
| 91 | ::: |
| 92 | |
| 93 | :::{grid-item-card} Neo |
| 94 | :link: libtmux.neo |
| 95 | :link-type: doc |
| 96 | Dataclass-based query interface. |
| 97 | ::: |
| 98 | |
| 99 | :::{grid-item-card} Options |
| 100 | :link: libtmux.options |
| 101 | :link-type: doc |
| 102 | tmux option get/set. |
| 103 | ::: |
| 104 | |
| 105 | :::{grid-item-card} Hooks |
| 106 | :link: libtmux.hooks |
| 107 | :link-type: doc |
| 108 | tmux hook management. |
| 109 | ::: |
| 110 | |
| 111 | :::{grid-item-card} Constants |
| 112 | :link: libtmux.constants |
| 113 | :link-type: doc |
| 114 | Format strings and constants. |
| 115 | ::: |
| 116 | |
| 117 | :::{grid-item-card} Exceptions |
| 118 | :link: libtmux.exc |
| 119 | :link-type: doc |
| 120 | Exception hierarchy. |
| 121 | ::: |
| 122 | |
| 123 | :::: |
| 124 | |
| 125 | ## Testing |
| 126 | |
| 127 | ::::{grid} 1 1 1 1 |
| 128 | :gutter: 2 |
| 129 | |
| 130 | :::{grid-item-card} Testing Utilities |
| 131 | :link: testing/index |
| 132 | :link-type: doc |
| 133 | {doc}`pytest plugin <testing/pytest-plugin/index>`, fixtures, and test helpers |
| 134 | for testing code that uses libtmux. |
| 135 | ::: |
| 136 | |
| 137 | :::: |
| 138 | |
| 139 | ## API Policy and Guarantees |
| 140 | |
| 141 | These documents define the project's promises about the public API. |
| 142 | |
| 143 | ::::{grid} 1 2 3 3 |
| 144 | :gutter: 2 |
| 145 | |
| 146 | :::{grid-item-card} Public API |
| 147 | :link: ../project/public-api |
| 148 | :link-type: doc |
| 149 | What is and is not considered stable public API. |
| 150 | ::: |
| 151 | |
| 152 | :::{grid-item-card} Compatibility |
| 153 | :link: ../project/compatibility |
| 154 | :link-type: doc |
| 155 | Supported versions of Python and tmux. |
| 156 | ::: |
| 157 | |
| 158 | :::{grid-item-card} Deprecations |
| 159 | :link: ../project/deprecations |
| 160 | :link-type: doc |
| 161 | Active deprecations and migration guidance. |
| 162 | ::: |
| 163 | |
| 164 | :::: |
| 165 | |
| 166 | ```{toctree} |
| 167 | :hidden: |
| 168 | :maxdepth: 1 |
| 169 | |
| 170 | Server <libtmux.server> |
| 171 | Session <libtmux.session> |
| 172 | Window <libtmux.window> |
| 173 | Pane <libtmux.pane> |
| 174 | Client <libtmux.client> |
| 175 | Common <libtmux.common> |
| 176 | Neo <libtmux.neo> |
| 177 | Options <libtmux.options> |
| 178 | Hooks <libtmux.hooks> |
| 179 | Constants <libtmux.constants> |
| 180 | Exceptions <libtmux.exc> |
| 181 | ``` |