Terminal Multiplexer Integration
VibeTunnel supports seamless integration with terminal multiplexers like tmux, Zellij, and GNU Screen, allowing you to attach to existing sessions and manage them through the web interface.Overview
The multiplexer integration allows you to:- List and attach to existing tmux/Zellij/Screen sessions
- Navigate between windows and panes (tmux)
- Create new sessions
- Kill sessions, windows (tmux), and panes (tmux)
- Maintain persistent terminal sessions across connections
Supported Multiplexers
tmux
- Full support for sessions, windows, and panes
- Shows session details including creation time, attached status, and window count
- Navigate to specific windows and panes
- Create sessions with optional initial commands
- Kill individual panes, windows, or entire sessions
Zellij
- Session management with creation time tracking
- Automatic session creation on first attach
- Layout support for new sessions
- ANSI color code handling in session names
- Proper cleanup of exited sessions
GNU Screen
- Session listing and management
- Shows session status (attached/detached)
- Create new sessions with optional commands
- Attach to existing sessions
- Kill sessions
Usage
Accessing Multiplexer Sessions
- Click the terminal icon in the session list
- The multiplexer modal will open showing available sessions
- For tmux sessions, expand to see windows and panes
- Click “Attach” to connect to any session, window, or pane
Creating New Sessions
tmux
Zellij
GNU Screen
API Endpoints
Get Multiplexer Status
Get tmux Windows
Get tmux Panes
Attach to Session
Kill Session
Kill Window (tmux only)
Kill Pane (tmux only)
Legacy tmux API Compatibility
The following legacy endpoints are maintained for backward compatibility:GET /api/tmux/sessions
- List tmux sessionsPOST /api/tmux/attach
- Attach to tmux session
Implementation Details
Architecture
The multiplexer integration consists of:MultiplexerManager
- Unified interface for all multiplexersTmuxManager
- tmux-specific implementationZellijManager
- Zellij-specific implementationScreenManager
- GNU Screen-specific implementationmultiplexer-modal
- LitElement component for the UI
Session Attachment
When attaching to a multiplexer session:- A new VibeTunnel PTY session is created
- The session runs the appropriate attach command:
- tmux:
tmux attach-session -t main
- Zellij:
zellij attach main
- Screen:
screen -r 12345.main
- tmux:
- The multiplexer takes over the terminal, providing its own UI
- Users can navigate within the multiplexer using native keybindings
Key Features
Automatic Detection
The system automatically detects installed multiplexers and only shows available options.Session Persistence
Multiplexer sessions persist even when VibeTunnel is restarted, allowing you to maintain long-running processes.Native Experience
Once attached, you interact with the multiplexer using its native keybindings:- tmux:
Ctrl-B
(default prefix) - Zellij:
Ctrl-G
(default prefix) - Screen:
Ctrl-A
(default prefix)
Clean Session Names
Zellij session names are automatically cleaned of ANSI escape codes for better display.Kill Confirmation
All destructive actions (killing sessions, windows, panes) require confirmation to prevent accidental data loss.Best Practices
- Use descriptive session names - Makes it easier to identify sessions later
- Organize with windows (tmux) - Group related tasks in different windows
- Leverage layouts (Zellij) - Use predefined layouts for common workflows
- Clean up old sessions - Kill sessions you’re no longer using to free resources
Troubleshooting
Sessions Not Showing
- Ensure tmux/Zellij/Screen is installed on the system
- Check that sessions exist by running:
- tmux:
tmux ls
- Zellij:
zellij list-sessions
- Screen:
screen -ls
- tmux:
Cannot Attach to Session
- Verify the session name is correct
- Check if the session is already attached elsewhere (some configurations prevent multiple attachments)
Display Issues
- Ensure terminal dimensions match between client and server
- Try resizing the browser window to trigger a resize event
Screen-Specific Issues
- Screen returns exit code 1 when sessions exist (this is normal behavior)
- Session names include PID prefix (e.g.,
12345.session-name
) - Use
screen -R
instead ofscreen -r
for more forgiving reattachment