You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`libtmux` is a typed Python API for controlling [tmux](https://github.com/tmux/tmux), letting you programmatically manage sessions, windows, and panes with an intuitive object-oriented interface.
11
+
**libtmux** is a fully typed Python API that provides seamless control over [tmux](https://github.com/tmux/tmux), the popular terminal multiplexer. Design your terminal workflows in clean, Pythonic code with an intuitive object-oriented interface.
12
+
13
+
## Why Use libtmux?
14
+
15
+
- 💪 **Powerful Abstractions**: Manage tmux sessions, windows, and panes through a clean object model
# Switch back to the editor window to start working
53
+
editor.select_window()
35
54
```
36
55
37
-
## Overview
56
+
## Architecture: Clean Hierarchical Design
38
57
39
-
`libtmux` is a [typed](https://docs.python.org/3/library/typing.html) Python library that provides a wrapper for interacting programmatically with tmux, a terminal multiplexer. You can use it to manage tmux servers, sessions, windows, and panes. Additionally, `libtmux` powers [tmuxp], a tmux workspace manager.
58
+
libtmux mirrors tmux's natural hierarchy with a clean object model:
40
59
41
60
```
42
61
┌─────────────────────────┐
43
-
│ Server │
62
+
│ Server │ ← Connect to local or remote tmux servers
44
63
└───────────┬─────────────┘
45
64
│
46
65
┌───────────▼─────────────┐
47
-
│ Sessions │
66
+
│ Sessions │ ← Organize work into logical sessions
48
67
└───────────┬─────────────┘
49
68
│
50
69
┌───────────▼─────────────┐
51
-
│ Windows │
70
+
│ Windows │ ← Create task-specific windows (like browser tabs)
52
71
└───────────┬─────────────┘
53
72
│
54
73
┌───────────▼─────────────┐
55
-
│ Panes │
74
+
│ Panes │ ← Split windows into multiple views
56
75
└─────────────────────────┘
57
76
```
58
77
59
-
libtmux builds upon tmux's [target](http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#COMMANDS) and [formats](http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#FORMATS) to create an object mapping to traverse, inspect and interact with live tmux sessions.
60
-
61
78
## Installation
62
79
63
80
```console
64
-
$ pip install --user libtmux
65
-
```
66
-
67
-
## Quick Start Guide
68
-
69
-
### 1. Open a tmux session
81
+
# Basic installation
82
+
$ pip install libtmux
70
83
71
-
```console
72
-
$ tmux new-session -s foo -n bar
84
+
# With development tools
85
+
$ pip install libtmux[dev]
73
86
```
74
87
75
-
### 2. Connect to your tmux session with Python
88
+
##Getting Started
76
89
77
-
Start an interactive Python shell:
90
+
### 1. Create or attach to a tmux session
78
91
79
92
```console
80
-
$ python
93
+
$ tmux new-session -s my-session
81
94
```
82
95
83
-
For a better experience with autocompletions:
84
-
85
-
```console
86
-
$ pip install --user ptpython # or ipython
87
-
$ ptpython
88
-
```
89
-
90
-
Connect to a live tmux session:
96
+
### 2. Connect with Python
91
97
92
98
```python
93
-
>>>import libtmux
94
-
>>> server = libtmux.Server()
95
-
>>> server
96
-
Server(socket_path=/tmp/tmux-.../default)
97
-
```
98
-
99
-
**Tip**: You can also use [tmuxp]'s [`tmuxp shell`] to drop straight into your current tmux server/session/window/pane.
100
-
101
-
## Core Features
102
-
103
-
### Working with the Server
99
+
import libtmux
104
100
105
-
```python
106
-
# Connect with custom socket
107
-
server = libtmux.Server(socket_name='libtmux_doctest')
0 commit comments