--- name: tmux 监控 description: 启动 tmux 实时监控面板,显示会话、窗口、面板、进程、状态信息,定时刷新 --- ## 用户输入 ```text $ARGUMENTS ``` 执行前**必须**处理用户输入(非空时) ## 参数说明 支持以下参数(由 `tmux-monitor.sh` 统一处理): - (空) — 默认:在右侧新建面板,50/50 平分屏幕,1 秒刷新 - `<秒数>` — 自定义刷新间隔,如 `3` 表示每 3 秒刷新 - `-k` 或 `--kill` — 关闭监控面板 - `-r` 或 `--restart` — 重启监控面板 ## 执行步骤 ### 1. 解析参数,执行对应操作 根据 `$ARGUMENTS` 判断操作: - **`-k` / `--kill`**: 执行 `bash /workspace/scripts/tmux-monitor.sh -k`,输出结果后结束 - **`-r` / `--restart`**: 执行 `bash /workspace/scripts/tmux-monitor.sh -r`,进入步骤 2 验证 - **`<数字>`**: 执行 `bash /workspace/scripts/tmux-monitor.sh <数字>`,进入步骤 2 验证 - **(空)**: 执行 `bash /workspace/scripts/tmux-monitor.sh`,进入步骤 2 验证 ### 2. 验证 ```bash tmux list-panes -F '#{pane_index} #{pane_width}x#{pane_height} #{pane_active} #{pane_current_command}' ``` 确认: - 存在 2 个面板 - 宽度大致相等 - 新面板正在运行 `tmux-monitor.sh` ### 3. 输出结果 按以下格式输出: ```markdown ## tmux 监控面板已启动 | 项目 | 值 | |------|-----| | 刷新间隔 | {N} 秒 | | 工作面板 | Pane {N} ({W}x{H}) | | 监控面板 | Pane {N} ({W}x{H}) | ### 监控内容 - **会话** — 所有 tmux 会话及状态 - **窗口** — 当前会话的所有窗口、面板数、尺寸 - **面板** — 全部面板详情:命令、PID、路径、子进程 - **总计** — 会话/窗口/面板总数 ### 快捷操作 关闭监控: `/isos-tmux-monitor -k` 调整刷新: `/isos-tmux-monitor 3` (3秒刷新) 重启监控: `/isos-tmux-monitor -r` ```