Skip to content

feat(tui): make permission mode keybind configurable - #40334

Closed
CasualDeveloper wants to merge 1 commit into
anomalyco:devfrom
CasualDeveloper:feat/40331-permission-keybind
Closed

CasualDeveloper wants to merge 1 commit into
anomalyco:devfrom
CasualDeveloper:feat/40331-permission-keybind

Conversation

@CasualDeveloper

@CasualDeveloper CasualDeveloper commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #40331

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The TUI already supports toggling auto-approve permissions through the permission.mode command, but users cannot assign that command a key in tui.json.

This change adds app_toggle_auto_approve_permissions with no default binding, maps it to the existing command, and registers permission.mode with the app-level TUI bindings.

It does not change permission behavior, persistence, or default shortcuts.

How did you verify your code works?

  • Ran bun typecheck in packages/tui.
  • Ran bun typecheck in packages/opencode.
  • Confirmed through TuiConfig.resolve(...) that the configured key resolves to permission.mode.
  • Relaunched the TUI and confirmed that super+shift+a toggles the auto
    indicator and changes the command description between enabling and disabling auto-approve permissions.

Screenshots / recordings

Not applicable, since this change does not alter the rendered UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Process: human-directed and reviewed, with agentic assistance from openai/gpt-5.6-sol/high.

@CasualDeveloper
CasualDeveloper force-pushed the feat/40331-permission-keybind branch 5 times, most recently from 8492567 to 5f71def Compare August 8, 2026 20:34
@thepigdestroyer

Copy link
Copy Markdown

I independently implemented this same change before finding this PR, so here is a second data point in case it helps it along. I closed mine (#42057) in favour of this one.

Confirming it works: with app_toggle_auto_approve_permissions bound to a key in tui.json, resolving through TuiConfig.get() gives

permission.mode -> [{ desc: "Toggle auto-approve permissions", key: "ctrl+alt+n", cmd: "permission.mode" }]

and pressing it mid-session stops permission prompts appearing. I checked with a permission that evaluates to ask: the log shows asking id=per_…, then the action proceeding 30 ms later with no prompt rendered.

Worth noting for reviewers that the appBindingCommands line here is load-bearing, not cosmetic. appBindingCommands is what useBindings gathers a key layer from, so a Definitions plus CommandMap entry alone resolves but never binds, and the key silently does nothing. I hit exactly that when I first tried it with only the two keybind.ts edits.

Naming here is also better than mine, app_toggle_auto_approve_permissions is consistent with the other app_toggle_* definitions.

Let users bind the existing auto-approve toggle without changing its default behavior.

Closes anomalyco#40331
@CasualDeveloper
CasualDeveloper force-pushed the feat/40331-permission-keybind branch from 5f71def to 4f46637 Compare August 15, 2026 19:28
@CasualDeveloper

Copy link
Copy Markdown
Contributor Author

Closing this because V2 now supports the same behavior through #41882.

V2 keybinds use command IDs directly, so the binding is now configured in ~/.config/opencode/cli.json as:

{
  "keybinds": {
    "permission.mode": "super+shift+a"
  }
}

This PR targets the V1 dev keybind architecture and is no longer needed now that the equivalent behavior is implemented and tested in V2. Thanks @thepigdestroyer for independently validating the original implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add configurable TUI keybind for auto-approve permissions

2 participants