From 673c6f97b75d05ebf37cf20462f1fa8298b0b66b Mon Sep 17 00:00:00 2001 From: Adam <2363879+adamdotdevin@users.noreply.github.com> Date: Sun, 21 Dec 2025 04:56:20 -0600 Subject: [PATCH] fix(desktop): better keybind tooltips --- packages/desktop/src/components/header.tsx | 19 ++++-- .../desktop/src/components/prompt-input.tsx | 62 ++++++++++++------- packages/desktop/src/context/command.tsx | 5 ++ packages/desktop/src/pages/layout.tsx | 23 ++++++- packages/desktop/src/pages/session.tsx | 20 +++++- 5 files changed, 100 insertions(+), 29 deletions(-) diff --git a/packages/desktop/src/components/header.tsx b/packages/desktop/src/components/header.tsx index fd4b2c439..6e0ea96dc 100644 --- a/packages/desktop/src/components/header.tsx +++ b/packages/desktop/src/components/header.tsx @@ -10,6 +10,7 @@ import { Select } from "@opencode-ai/ui/select" import { TextField } from "@opencode-ai/ui/text-field" import { Tooltip } from "@opencode-ai/ui/tooltip" import { base64Decode } from "@opencode-ai/util/encode" +import { useCommand } from "@/context/command" import { getFilename } from "@opencode-ai/util/path" import { A, useParams } from "@solidjs/router" import { createMemo, createResource, Show } from "solid-js" @@ -24,6 +25,7 @@ export function Header(props: { const globalSDK = useGlobalSDK() const layout = useLayout() const params = useParams() + const command = useCommand() return (
@@ -80,9 +82,18 @@ export function Header(props: { /> - + + New session + {command.keybind("session.new")} + + } + > + +
@@ -91,7 +102,7 @@ export function Header(props: { value={
Toggle terminal - Ctrl ` + {command.keybind("terminal.toggle")}
} > diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsx index 78415cd2b..c548cea0e 100644 --- a/packages/desktop/src/components/prompt-input.tsx +++ b/packages/desktop/src/components/prompt-input.tsx @@ -19,7 +19,7 @@ import { useDialog } from "@opencode-ai/ui/context/dialog" import { DialogSelectModel } from "@/components/dialog-select-model" import { DialogSelectModelUnpaid } from "@/components/dialog-select-model-unpaid" import { useProviders } from "@/hooks/use-providers" -import { useCommand, formatKeybind } from "@/context/command" +import { useCommand } from "@/context/command" import { persisted } from "@/utils/persist" import { Identifier } from "@/utils/id" @@ -889,8 +889,8 @@ export const PromptInput: Component = (props) => { custom - - {formatKeybind(cmd.keybind!)} + + {command.keybind(cmd.id)}
@@ -990,26 +990,46 @@ export const PromptInput: Component = (props) => { - agent.name)} + current={local.agent.current().name} + onSelect={local.agent.set} + class="capitalize" + variant="ghost" + /> + + + Choose model + {command.keybind("model.choose")} + + } + > + + diff --git a/packages/desktop/src/context/command.tsx b/packages/desktop/src/context/command.tsx index 8fd76ee21..362f35b97 100644 --- a/packages/desktop/src/context/command.tsx +++ b/packages/desktop/src/context/command.tsx @@ -226,6 +226,11 @@ export const { use: useCommand, provider: CommandProvider } = createSimpleContex } } }, + keybind(id: string) { + const option = options().find((x) => x.id === id || x.id === "suggested." + id) + if (!option?.keybind) return "" + return formatKeybind(option.keybind) + }, show: showPalette, keybinds(enabled: boolean) { setSuspendCount((count) => count + (enabled ? -1 : 1)) diff --git a/packages/desktop/src/pages/layout.tsx b/packages/desktop/src/pages/layout.tsx index ade510069..1c8bb615c 100644 --- a/packages/desktop/src/pages/layout.tsx +++ b/packages/desktop/src/pages/layout.tsx @@ -674,7 +674,17 @@ export default function Layout(props: ParentProps) { />
- + + Toggle sidebar + {command.keybind("sidebar.toggle")} +
+ } + inactive={layout.sidebar.opened()} + >