114 lines
3.3 KiB
Markdown
114 lines
3.3 KiB
Markdown
# sethmux
|
|
|
|
Mobile-first web terminal powered by [ttyd](https://github.com/tsl0922/ttyd) + [tmux](https://github.com/tmux/tmux). One persistent session, multiple tabs, accessible from any browser.
|
|
|
|
## Features
|
|
|
|
- **Single persistent tmux session** — shared across all connected clients
|
|
- **Mobile touch toolbar** — on-screen buttons for tabs, signals, navigation, splits, and text selection
|
|
- **Text selection mode** — tap `Sel` to select and copy text on touch devices
|
|
- **Push notifications** — `sethmux-notify "Build done!"` sends browser notifications
|
|
- **PWA installable** — add to home screen for app-like experience
|
|
- **Dark theme** — Sethian dark + orange (#D35400) accent
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Browser -> Caddy (HTTPS + Auth) -> ttyd (port 7683) -> tmux session "sethmux"
|
|
-> notify-server (port 7684) -> /api/notifications
|
|
```
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Dependencies
|
|
apt install -y tmux
|
|
curl -sL https://github.com/tsl0922/ttyd/releases/latest/download/ttyd.x86_64 -o /usr/local/bin/ttyd
|
|
chmod +x /usr/local/bin/ttyd
|
|
|
|
# Deploy
|
|
sudo mkdir -p /opt/sethmux
|
|
sudo cp static/* /opt/sethmux/
|
|
sudo cp notify-server.py /opt/sethmux/
|
|
sudo cp sethmux-notify /usr/local/bin/
|
|
sudo cp config/tmux.conf ~/.tmux.conf
|
|
sudo cp systemd/*.service /etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable --now sethmux sethmux-notify
|
|
```
|
|
|
|
Open `http://YOUR_IP:7683` in a browser.
|
|
|
|
## Mobile Toolbar
|
|
|
|
Appears on screens < 900px. Buttons:
|
|
|
|
| Button | Action | tmux Key |
|
|
|--------|--------|----------|
|
|
| **+Tab** | New tab | `Ctrl-A c` |
|
|
| **Next/Prev** | Switch tabs | `Ctrl-A n/p` |
|
|
| **^C / ^D / Clr** | Interrupt / EOF / Clear | |
|
|
| **Esc / Tab / Up / Down** | Navigation | |
|
|
| **Sel** | Text selection mode | |
|
|
| **Spl** | Split vertical | `Ctrl-A %` |
|
|
| **Pane** | Cycle panes | `Ctrl-A o` |
|
|
| **Kill** | Kill pane/tab | `Ctrl-A x` |
|
|
|
|
## Push Notifications
|
|
|
|
```bash
|
|
sethmux-notify "Deploy complete!"
|
|
echo "done" | sethmux-notify
|
|
make build && sethmux-notify "OK" || sethmux-notify "FAIL"
|
|
```
|
|
|
|
## tmux Keybindings
|
|
|
|
Prefix: `Ctrl-A` (not the default Ctrl-B — easier on mobile).
|
|
|
|
| Key | Action |
|
|
|-----|--------|
|
|
| `Ctrl-A c` | New window |
|
|
| `Ctrl-A n / p` | Next / previous |
|
|
| `Ctrl-A % / "` | Split vertical / horizontal |
|
|
| `Ctrl-A o` | Cycle panes |
|
|
| `Ctrl-A x` | Kill pane |
|
|
| `Alt-1` to `Alt-5` | Jump to window |
|
|
| Mouse scroll | History |
|
|
|
|
## Reverse Proxy (Caddy)
|
|
|
|
```
|
|
mux.example.com {
|
|
# your auth here
|
|
handle /toolbar.js { root * /opt/sethmux; file_server }
|
|
handle /manifest.json { root * /opt/sethmux; file_server }
|
|
handle /icon-*.png { root * /opt/sethmux; file_server }
|
|
handle /api/* { uri strip_prefix /api; reverse_proxy localhost:7684 }
|
|
handle { reverse_proxy localhost:7683 }
|
|
}
|
|
```
|
|
|
|
## Files
|
|
|
|
```
|
|
sethmux/
|
|
static/
|
|
index.html # Custom ttyd page with toolbar injection
|
|
toolbar.js # Mobile touch toolbar
|
|
manifest.json # PWA manifest
|
|
icon-192.png # PWA icon
|
|
icon-512.png # PWA icon
|
|
config/
|
|
tmux.conf # Sethian-themed tmux config
|
|
systemd/
|
|
sethmux.service # ttyd + tmux systemd unit
|
|
sethmux-notify.service # Notification API unit
|
|
notify-server.py # Push notification HTTP API
|
|
sethmux-notify # CLI notification command
|
|
```
|
|
|
|
## License
|
|
|
|
MIT
|