clash_tui/SUMMARY.md
yly 4d79ba5884 Implement Clash TUI with iocraft
Fullscreen terminal UI for Clash proxy manager with proxy selector,
connections viewer, configurable keybindings, and TOML config support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-18 02:09:51 +08:00

79 lines
2.3 KiB
Markdown

# Clash TUI
A fullscreen terminal UI for controlling the [Clash](https://github.com/Dreamacro/clash) proxy manager API, built with Rust and [iocraft](https://github.com/ccbrown/iocraft).
## Features
- **Proxy selector** -- browse proxy groups in a two-pane layout, switch active proxies
- **Connections viewer** -- view active connections in a sortable table, close individual or all connections
- **Configurable keybindings** -- customize all shortcuts via TOML config
- **Periodic auto-refresh** -- configurable refresh interval (default 2s)
- **Mouse support** -- click tabs to switch views
## Configuration
Config file: `~/.config/clash_tui/config.toml`
```toml
clash_api_url = "http://127.0.0.1:9090"
clash_api_secret = "your-secret" # optional
refresh_interval = 2 # seconds
[keybindings]
quit = "q"
tab_next = "Tab"
tab_prev = "BackTab"
up = "Up"
down = "Down"
left = "Left"
right = "Right"
select = "Enter"
close_connection = "d"
close_all_connections = "shift+d"
refresh = "r"
```
All keybindings and settings are optional and use the defaults shown above.
## CLI Usage
```
cargo run -- [OPTIONS]
Options:
--api-address <URL> Override Clash API address
--api-secret <KEY> Override Clash API secret
--refresh-interval <SECS> Override refresh interval
```
CLI arguments override config file values.
## Default Keybindings
| Key | Action |
|-----------|-----------------------|
| `q` | Quit |
| `Tab` | Next tab |
| `BackTab` | Previous tab |
| `Up/Down` | Navigate list |
| `Left` | Switch to groups pane |
| `Right` | Switch to members pane|
| `Enter` | Select proxy |
| `d` | Close connection |
| `D` | Close all connections |
| `r` | Force refresh |
## File Structure
```
src/
main.rs -- Entry point, CLI parsing, config loading
config.rs -- Config structs, TOML loading, CLI merging
keybindings.rs -- KeyBinding parsing and matching
clash.rs -- Clash API client + serde types
app.rs -- Root App component (fullscreen, tabs)
tab_bar.rs -- Clickable tab bar component
proxy_view.rs -- Proxy selector (two-pane layout)
connections_view.rs -- Connections table view
```