@@ -125,6 +125,8 @@ import type { EventSource } from "./context/sdk"
|
|||||||
import { DialogVariant } from "./component/dialog-variant"
|
import { DialogVariant } from "./component/dialog-variant"
|
||||||
|
|
||||||
function rendererConfig(_config: TuiConfig.Info): CliRendererConfig {
|
function rendererConfig(_config: TuiConfig.Info): CliRendererConfig {
|
||||||
|
const mouseEnabled = !Flag.OPENCODE_DISABLE_MOUSE && (_config.mouse ?? true)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
externalOutputMode: "passthrough",
|
externalOutputMode: "passthrough",
|
||||||
targetFps: 60,
|
targetFps: 60,
|
||||||
@@ -133,6 +135,7 @@ function rendererConfig(_config: TuiConfig.Info): CliRendererConfig {
|
|||||||
useKittyKeyboard: { events: process.platform === "win32" },
|
useKittyKeyboard: { events: process.platform === "win32" },
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
openConsoleOnError: false,
|
openConsoleOnError: false,
|
||||||
|
useMouse: mouseEnabled,
|
||||||
consoleOptions: {
|
consoleOptions: {
|
||||||
keyBindings: [{ name: "y", ctrl: true, action: "copy-selection" }],
|
keyBindings: [{ name: "y", ctrl: true, action: "copy-selection" }],
|
||||||
onCopySelection: (text) => {
|
onCopySelection: (text) => {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const TuiOptions = z.object({
|
|||||||
.enum(["auto", "stacked"])
|
.enum(["auto", "stacked"])
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),
|
.describe("Control diff rendering style: 'auto' adapts to terminal width, 'stacked' always shows single column"),
|
||||||
|
mouse: z.boolean().optional().describe("Enable or disable mouse capture (default: true)"),
|
||||||
})
|
})
|
||||||
|
|
||||||
export const TuiInfo = z
|
export const TuiInfo = z
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ export namespace Flag {
|
|||||||
export const OPENCODE_ENABLE_EXPERIMENTAL_MODELS = truthy("OPENCODE_ENABLE_EXPERIMENTAL_MODELS")
|
export const OPENCODE_ENABLE_EXPERIMENTAL_MODELS = truthy("OPENCODE_ENABLE_EXPERIMENTAL_MODELS")
|
||||||
export const OPENCODE_DISABLE_AUTOCOMPACT = truthy("OPENCODE_DISABLE_AUTOCOMPACT")
|
export const OPENCODE_DISABLE_AUTOCOMPACT = truthy("OPENCODE_DISABLE_AUTOCOMPACT")
|
||||||
export const OPENCODE_DISABLE_MODELS_FETCH = truthy("OPENCODE_DISABLE_MODELS_FETCH")
|
export const OPENCODE_DISABLE_MODELS_FETCH = truthy("OPENCODE_DISABLE_MODELS_FETCH")
|
||||||
|
export const OPENCODE_DISABLE_MOUSE = truthy("OPENCODE_DISABLE_MOUSE")
|
||||||
export const OPENCODE_DISABLE_CLAUDE_CODE = truthy("OPENCODE_DISABLE_CLAUDE_CODE")
|
export const OPENCODE_DISABLE_CLAUDE_CODE = truthy("OPENCODE_DISABLE_CLAUDE_CODE")
|
||||||
export const OPENCODE_DISABLE_CLAUDE_CODE_PROMPT =
|
export const OPENCODE_DISABLE_CLAUDE_CODE_PROMPT =
|
||||||
OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT")
|
OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT")
|
||||||
|
|||||||
@@ -573,6 +573,7 @@ OpenCode can be configured using environment variables.
|
|||||||
| `OPENCODE_DISABLE_CLAUDE_CODE_PROMPT` | boolean | Disable reading `~/.claude/CLAUDE.md` |
|
| `OPENCODE_DISABLE_CLAUDE_CODE_PROMPT` | boolean | Disable reading `~/.claude/CLAUDE.md` |
|
||||||
| `OPENCODE_DISABLE_CLAUDE_CODE_SKILLS` | boolean | Disable loading `.claude/skills` |
|
| `OPENCODE_DISABLE_CLAUDE_CODE_SKILLS` | boolean | Disable loading `.claude/skills` |
|
||||||
| `OPENCODE_DISABLE_MODELS_FETCH` | boolean | Disable fetching models from remote sources |
|
| `OPENCODE_DISABLE_MODELS_FETCH` | boolean | Disable fetching models from remote sources |
|
||||||
|
| `OPENCODE_DISABLE_MOUSE` | boolean | Disable mouse capture in the TUI |
|
||||||
| `OPENCODE_FAKE_VCS` | string | Fake VCS provider for testing purposes |
|
| `OPENCODE_FAKE_VCS` | string | Fake VCS provider for testing purposes |
|
||||||
| `OPENCODE_DISABLE_FILETIME_CHECK` | boolean | Disable file time checking for optimization |
|
| `OPENCODE_DISABLE_FILETIME_CHECK` | boolean | Disable file time checking for optimization |
|
||||||
| `OPENCODE_CLIENT` | string | Client identifier (defaults to `cli`) |
|
| `OPENCODE_CLIENT` | string | Client identifier (defaults to `cli`) |
|
||||||
|
|||||||
@@ -272,7 +272,8 @@ Use a dedicated `tui.json` (or `tui.jsonc`) file for TUI-specific settings.
|
|||||||
"scroll_acceleration": {
|
"scroll_acceleration": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"diff_style": "auto"
|
"diff_style": "auto",
|
||||||
|
"mouse": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -280,8 +281,6 @@ Use `OPENCODE_TUI_CONFIG` to point to a custom TUI config file.
|
|||||||
|
|
||||||
Legacy `theme`, `keybinds`, and `tui` keys in `opencode.json` are deprecated and automatically migrated when possible.
|
Legacy `theme`, `keybinds`, and `tui` keys in `opencode.json` are deprecated and automatically migrated when possible.
|
||||||
|
|
||||||
[Learn more about TUI configuration here](/docs/tui#configure).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
|
|||||||
@@ -368,7 +368,8 @@ You can customize TUI behavior through `tui.json` (or `tui.jsonc`).
|
|||||||
"scroll_acceleration": {
|
"scroll_acceleration": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"diff_style": "auto"
|
"diff_style": "auto",
|
||||||
|
"mouse": true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -381,6 +382,7 @@ This is separate from `opencode.json`, which configures server/runtime behavior.
|
|||||||
- `scroll_acceleration.enabled` - Enable macOS-style scroll acceleration for smooth, natural scrolling. When enabled, scroll speed increases with rapid scrolling gestures and stays precise for slower movements. **This setting takes precedence over `scroll_speed` and overrides it when enabled.**
|
- `scroll_acceleration.enabled` - Enable macOS-style scroll acceleration for smooth, natural scrolling. When enabled, scroll speed increases with rapid scrolling gestures and stays precise for slower movements. **This setting takes precedence over `scroll_speed` and overrides it when enabled.**
|
||||||
- `scroll_speed` - Controls how fast the TUI scrolls when using scroll commands (minimum: `0.001`, supports decimal values). Defaults to `3`. **Note: This is ignored if `scroll_acceleration.enabled` is set to `true`.**
|
- `scroll_speed` - Controls how fast the TUI scrolls when using scroll commands (minimum: `0.001`, supports decimal values). Defaults to `3`. **Note: This is ignored if `scroll_acceleration.enabled` is set to `true`.**
|
||||||
- `diff_style` - Controls diff rendering. `"auto"` adapts to terminal width, `"stacked"` always shows a single-column layout.
|
- `diff_style` - Controls diff rendering. `"auto"` adapts to terminal width, `"stacked"` always shows a single-column layout.
|
||||||
|
- `mouse` - Enable or disable mouse capture in the TUI (default: `true`). When disabled, the terminal's native mouse selection/scrolling behavior is preserved.
|
||||||
|
|
||||||
Use `OPENCODE_TUI_CONFIG` to load a custom TUI config path.
|
Use `OPENCODE_TUI_CONFIG` to load a custom TUI config path.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user