summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJaga Santagostino <[email protected]>2025-12-02 22:11:03 +0100
committerGitHub <[email protected]>2025-12-02 15:11:03 -0600
commitf17e1def32c36c7eb89d1a1e810c0de4ed71c424 (patch)
treed47993d3af2ba988e0056e19152722132baf3e27
parent3183e8b7d432aea37f7723bbfd6e7258bbf2f219 (diff)
downloadopencode-f17e1def32c36c7eb89d1a1e810c0de4ed71c424.tar.gz
opencode-f17e1def32c36c7eb89d1a1e810c0de4ed71c424.zip
toggle to hide username in TUI (#4750)
Co-authored-by: Aiden Cline <[email protected]>
-rw-r--r--packages/opencode/src/cli/cmd/tui/routes/session/index.tsx19
-rw-r--r--packages/opencode/src/config/config.ts1
-rw-r--r--packages/sdk/js/src/gen/types.gen.ts4
-rw-r--r--packages/web/src/content/docs/keybinds.mdx1
-rw-r--r--packages/web/src/content/docs/tui.mdx13
5 files changed, 37 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
index 83f44c944..b0860c0b8 100644
--- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx
@@ -81,6 +81,7 @@ const context = createContext<{
conceal: () => boolean
showThinking: () => boolean
showTimestamps: () => boolean
+ usernameVisible: () => boolean
showDetails: () => boolean
diffWrapMode: () => "word" | "none"
sync: ReturnType<typeof useSync>
@@ -115,6 +116,7 @@ export function Session() {
const [conceal, setConceal] = createSignal(true)
const [showThinking, setShowThinking] = createSignal(kv.get("thinking_visibility", true))
const [showTimestamps, setShowTimestamps] = createSignal(kv.get("timestamps", "hide") === "show")
+ const [usernameVisible, setUsernameVisible] = createSignal(kv.get("username_visible", true))
const [showDetails, setShowDetails] = createSignal(kv.get("tool_details_visibility", true))
const [diffWrapMode, setDiffWrapMode] = createSignal<"word" | "none">("word")
@@ -420,6 +422,20 @@ export function Session() {
},
},
{
+ title: usernameVisible() ? "Hide username" : "Show username",
+ value: "session.username_visible.toggle",
+ keybind: "username_toggle",
+ category: "Session",
+ onSelect: (dialog) => {
+ setUsernameVisible((prev) => {
+ const next = !prev
+ kv.set("username_visible", next)
+ return next
+ })
+ dialog.clear()
+ },
+ },
+ {
title: "Toggle code concealment",
value: "session.toggle.conceal",
keybind: "messages_toggle_conceal" as any,
@@ -776,6 +792,7 @@ export function Session() {
conceal,
showThinking,
showTimestamps,
+ usernameVisible,
showDetails,
diffWrapMode,
sync,
@@ -995,7 +1012,7 @@ function UserMessage(props: {
</box>
</Show>
<text fg={theme.textMuted}>
- {sync.data.config.username ?? "You"}{" "}
+ {ctx.usernameVisible() ? `${sync.data.config.username ?? "You"} ` : "You"}{" "}
<Show
when={queued()}
fallback={
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index a49612090..3ed487653 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -398,6 +398,7 @@ export namespace Config {
editor_open: z.string().optional().default("<leader>e").describe("Open external editor"),
theme_list: z.string().optional().default("<leader>t").describe("List available themes"),
sidebar_toggle: z.string().optional().default("<leader>b").describe("Toggle sidebar"),
+ username_toggle: z.string().optional().default("none").describe("Toggle username visibility"),
status_view: z.string().optional().default("<leader>s").describe("View status"),
session_export: z.string().optional().default("<leader>x").describe("Export session to editor"),
session_new: z.string().optional().default("<leader>n").describe("Create a new session"),
diff --git a/packages/sdk/js/src/gen/types.gen.ts b/packages/sdk/js/src/gen/types.gen.ts
index d81fda9f8..f8e1d34fb 100644
--- a/packages/sdk/js/src/gen/types.gen.ts
+++ b/packages/sdk/js/src/gen/types.gen.ts
@@ -733,6 +733,10 @@ export type KeybindsConfig = {
*/
sidebar_toggle?: string
/**
+ * Toggle username visibility
+ */
+ username_toggle?: string
+ /**
* View status
*/
status_view?: string
diff --git a/packages/web/src/content/docs/keybinds.mdx b/packages/web/src/content/docs/keybinds.mdx
index afcff3a0e..80a74c159 100644
--- a/packages/web/src/content/docs/keybinds.mdx
+++ b/packages/web/src/content/docs/keybinds.mdx
@@ -14,6 +14,7 @@ OpenCode has a list of keybinds that you can customize through the OpenCode conf
"editor_open": "<leader>e",
"theme_list": "<leader>t",
"sidebar_toggle": "<leader>b",
+ "username_toggle": "none",
"status_view": "<leader>s",
"session_export": "<leader>x",
"session_new": "<leader>n",
diff --git a/packages/web/src/content/docs/tui.mdx b/packages/web/src/content/docs/tui.mdx
index a580a4ce8..2543df639 100644
--- a/packages/web/src/content/docs/tui.mdx
+++ b/packages/web/src/content/docs/tui.mdx
@@ -348,3 +348,16 @@ You can customize TUI behavior through your OpenCode config file.
- `scroll_acceleration` - 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: `1`). Defaults to `1` on Unix and `3` on Windows. **Note: This is ignored if `scroll_acceleration.enabled` is set to `true`.**
+
+---
+
+## View customization
+
+You can customize various aspects of the TUI view using the command palette (`ctrl+x h` or `/help`). These settings persist across restarts.
+
+### Username display
+
+Toggle whether your username appears in chat messages. Access this through:
+
+- Command palette: Search for "username" or "hide username"
+- The setting persists automatically and will be remembered across TUI sessions