toggle to hide username in TUI (#4750)

Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
This commit is contained in:
Jaga Santagostino
2025-12-02 22:11:03 +01:00
committed by GitHub
parent 3183e8b7d4
commit f17e1def32
5 changed files with 37 additions and 1 deletions

View File

@@ -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")
@@ -419,6 +421,20 @@ export function Session() {
dialog.clear()
},
},
{
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",
@@ -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={

View File

@@ -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"),