Outer tmux cockpit for local and SSH tmux sessions
Project description
mtmux
Every tmux session, local or remote, at your fingertips.
mtmux runs inside your existing terminal and works on top of tmux. No new terminal app, no replacement tmux setup, no retraining your keyboard muscle memory. Keep your terminal, tmux configuration, keybindings, plugins, and workflows while adding a persistent sidebar for finding, opening, and switching between sessions across your machine and SSH hosts. Your sessions remain ordinary tmux sessions; mtmux simply puts them within reach.
Star important sessions, see at a glance which ones need attention, and jump between local and remote work without hunting through terminal tabs.
Why mtmux?
- Keep your terminal and tmux setup: unlike cmux, mtmux runs inside your current terminal and builds on tmux instead of forcing a new terminal app. Your configuration, keybindings, plugins, and workflows keep working.
- One view across machines: local and remote sessions live in the same sidebar.
- Fast context switches: see which sessions need your attention via tmux bells, then jump straight to them.
Quick start
Requires Python 3.11+, tmux, and OpenSSH. Automatic coding-agent discovery additionally requires astatus locally and on configured remote hosts.
git clone https://github.com/julsemaan/mtmux.git
cd mtmux
pip install -e .
mtmux cockpit
That opens an outer tmux workspace with the mtmux sidebar on the left and your selected session on the right. Press Enter on a session to step into it; press q to close the sidebar, then C-s s to reopen it on Sessions.
Development
make dev-install
make test # unit tests
make lint # Ruff
make coverage # branch coverage (85% minimum)
make build-check # build distributions and validate metadata
make check # all quality gates
How it works
mtmux cockpit creates or attaches to a dedicated outer tmux server. That outer layer owns only the layout:
- outer prefix:
C-s - focus/open Sessions:
C-s s - add session:
C-s + - focus/open Agents:
C-s a - hide sidebar:
C-s h - quit cockpit:
C-s q - show help:
C-s ? - detach cockpit:
C-s d - forward outer prefix to inner session:
C-s C-s - standard outer tmux prefix bindings: disabled
- outer status: off
- left pane:
mtmuxsidebar, 40 columns by default - right pane: selected local/remote tmux attach client
Inner local and remote sessions keep their normal tmux prefix and bindings, and remain alive when you switch away. Only mtmux's outer prefix key table is restricted.
Configuration
Files live in ~/.config/mtmux/:
hosts = ["my-remote-machine"]
prefix = "C-s"
sidebar_width = 40
status_timeout = 5
persistent_ssh = true
Prefix
prefix accepts one non-empty, printable tmux key token without whitespace. sidebar_width sets left pane width in columns. status_timeout controls how many seconds sidebar feedback remains visible. Both numeric settings must be positive integers. Restart sidebar by rerunning mtmux cockpit after changing these values.
C-s normally sends XOFF when terminal IXON flow control is enabled. Attached tmux disables flow control on outer tty, so outer prefix works without global stty changes. Readline, Emacs, or Vim C-s commands require C-s C-s to forward literal C-s; inner tty may still treat it as XOFF, in which case C-q resumes output.
To restore old prefix, set prefix = "C-g" and rerun mtmux cockpit.
Remote hosts
Hosts are SSH aliases only. Keep host-specific users, ports, keys, proxies, IPv6, and other connection settings in ~/.ssh/config.
By default, mtmux makes OpenSSH reuse one authenticated transport per host with ControlMaster=auto, ControlPersist=10m, and ControlPath=~/.ssh/mtmux-%C. Later discovery polls, switches, creates, and kills avoid repeating TCP setup, key exchange, and authentication. Control sockets remain for 10 minutes after last use.
Every mtmux SSH connection also uses ServerAliveInterval=60 and ServerAliveCountMax=3 to detect dead connections and keep idle sessions active through network and NAT timeouts. Keepalive remains enabled when persistent_ssh is disabled.
To omit mtmux's persistence options, set:
persistent_ssh = false
SSH config still applies, so this opt-out does not disable multiplexing configured there.
Names of the hosts must match:
[A-Za-z0-9_.-]{1,64}
CLI commands
mtmux list
mtmux switch local:<session>
mtmux switch ssh:<host>:<session>
mtmux switch-star <1-9>
mtmux create local <session>
mtmux create ssh <host> <session>
mtmux kill local:<session>
mtmux kill ssh:<host>:<session>
Switching uses outer tmux respawn-pane on right pane. Real tmux sessions stay alive.
Sidebar keys
C-s s: focus Sessions; recreates sidebar if quitC-s +: focus Sessions and open Add session menuC-s a: focus Agents; recreates sidebar if quitC-s h: hide sidebarC-s q: quit outer mtmux cockpitC-s ?: show help in right paneC-s d: detach outer mtmux cockpitC-s C-s: forwardC-sto inner sessionC-s 1–C-s 9: switch directly to numbered starred targetj/kor arrows: move selection pointer (›) in focused region[/]: give Agents/Sessions region more rows for current runh/l: cycle agent ordering mode (Priority / Session) when ordering row is selectedEnter: switch selected session or exact agent pane, or activate selected Add rowa: open Add session menu from Sessions or Agentsr: remove selected target without killing itK/J: move selected starred target up/down without wrappingx: kill selected session but retain its star (asks first)/: open existing-session search directly?: open help in right paneq: quit sidebar only
› marks keyboard selection; mint reverse highlight marks active cockpit session. Both appear independently while sidebar is focused. Unfocused sidebar hides pointer and keeps active session highlighted and visible.
Normal sidebar lists sessions in persisted order. Add menu separates New session from Existing session. New-session flow skips location selection when exactly one local/SSH location is available; multiple locations use dedicated picker, then dedicated name input. Existing-session search lists only untracked sessions. Selecting or creating one persists it and switches immediately. Independently navigable Agents region remains visible below AGENTS divider when Add menu is closed. First nine sessions receive shortcut numbers; K/J updates order. Missing sessions remain launchers: Enter uses tmux new-session -A to recreate and attach. Sessions persist in ~/.config/mtmux/stars. Only tracked sessions trigger sidebar bell indicators and beeps. Set MTMUX_ASCII=1 for text-only labels and ellipses.
Agent records are read from $AGENT_STATUS_DIR, $XDG_STATE_HOME/agent-status, or ~/.local/state/agent-status, in that order. Local and remote running agents updated within 60 seconds are correlated by exact tmux socket and pane ID. Selecting agent navigates to exact server, window, and pane; active agent name and location remain orange independently of keyboard selection. Working agents show for <duration>; other states show no duration. Working durations prefer task.status_timestamp and fall back to runtime.updated_at; unusable optional timestamps omit duration. Each agent row starts with a semantic status icon; working agents use an animated Braille spinner. Focused selection replaces that icon with ›, and moving focus away restores it. Status icon and text share semantic color; selection cursor stays orange. MTMUX_ASCII=1 uses ASCII icons, spinner frames, and > cursor. Attention states remain bold and idle/canceled remain dim without color. Agents are discovered automatically, but only agents in tracked sessions appear. Agents cannot be added, removed, reordered, or killed as favorites.
When a tracked agent changes from working to idle, completed, input-required, auth-required, failed, rejected, or canceled, sidebar beeps once and marks that exact pane/agent with 🔔 (BELL in ASCII mode). Initial discovery does not alert. Marker survives later state changes until exact pane opens, is already active during discovery, disappears from discovery, or sidebar restarts.
Mouse controls
- click session row: select and switch
- click
+ add, Add choice, or available location row: activate same flow asEnter - wheel over sidebar: navigate selectable session and host rows
- right-pane mouse events: forwarded by outer tmux to mouse-aware applications
- live border dragging: disabled so text selection can cross the sidebar divider without resizing it
Tmux mouse capture may require holding Shift for terminal-native text selection.
Clipboard
Native tmux copy mode forwards copied text through nested sessions using OSC 52. Physical terminal must support and enable OSC 52 clipboard access. mtmux declares inner clients as clipboard capable and sets outer server option set-clipboard on; inner tmux configuration remains unchanged, including explicit set-clipboard off.
Security: set-clipboard on permits processes in local and remote panes to set system clipboard through OSC 52. Only connect to trusted hosts and run trusted pane processes.
Recovery
Press C-s s to reopen Sessions, C-s a to reopen Agents, or rerun:
mtmux cockpit
It reuses valid cockpit, repairs broken window, and respawns missing sidebar.
License
Licensed under the Apache License 2.0.
Missing cockpit for switch/create prints:
No valid mtmux cockpit. Run: mtmux cockpit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mtmux-0.1.2.tar.gz.
File metadata
- Download URL: mtmux-0.1.2.tar.gz
- Upload date:
- Size: 71.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
096bcb602575da9aa08cf932488eb841250e935e54f2808d3e85c7f0f0fd3573
|
|
| MD5 |
b68d3fbfbc2a1af9223f37d6533b4ba9
|
|
| BLAKE2b-256 |
69b6b8eeb5f357f76e241cf0748e06dd3f87ef4243f46b50d53be8a6fbc1889b
|
Provenance
The following attestation bundles were made for mtmux-0.1.2.tar.gz:
Publisher:
build-publish.yaml on julsemaan/mtmux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mtmux-0.1.2.tar.gz -
Subject digest:
096bcb602575da9aa08cf932488eb841250e935e54f2808d3e85c7f0f0fd3573 - Sigstore transparency entry: 2256689189
- Sigstore integration time:
-
Permalink:
julsemaan/mtmux@d9f31e12a2c8ec7aa266235473417fa88ee09c12 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/julsemaan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-publish.yaml@d9f31e12a2c8ec7aa266235473417fa88ee09c12 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mtmux-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mtmux-0.1.2-py3-none-any.whl
- Upload date:
- Size: 40.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
54c8b59b8427b8400c02e99fb987e4af9cc47a91885da20298d95f027af23f1e
|
|
| MD5 |
ef81949e3750d5fda539801bcc43eefc
|
|
| BLAKE2b-256 |
64e2c49959e7a5a367f99e8b44fbd69a456fcda109a1708e0113f2201eb1588d
|
Provenance
The following attestation bundles were made for mtmux-0.1.2-py3-none-any.whl:
Publisher:
build-publish.yaml on julsemaan/mtmux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mtmux-0.1.2-py3-none-any.whl -
Subject digest:
54c8b59b8427b8400c02e99fb987e4af9cc47a91885da20298d95f027af23f1e - Sigstore transparency entry: 2256689198
- Sigstore integration time:
-
Permalink:
julsemaan/mtmux@d9f31e12a2c8ec7aa266235473417fa88ee09c12 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/julsemaan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-publish.yaml@d9f31e12a2c8ec7aa266235473417fa88ee09c12 -
Trigger Event:
push
-
Statement type: