diff --git a/docs/docs/waveai.mdx b/docs/docs/waveai.mdx index ab9259d5a..5189bc679 100644 --- a/docs/docs/waveai.mdx +++ b/docs/docs/waveai.mdx @@ -19,7 +19,7 @@ Context-aware terminal assistant with access to terminal output, widgets, and fi | Shortcut | Action | |----------|--------| | | Toggle AI panel | -| | Focus AI input | +| | Focus AI input | | | Clear chat / start new | | | Send message | | | New line | diff --git a/docs/src/components/kbd.tsx b/docs/src/components/kbd.tsx index 21eb0b3c6..b42b1d55c 100644 --- a/docs/src/components/kbd.tsx +++ b/docs/src/components/kbd.tsx @@ -44,9 +44,20 @@ function convertKey(platform: Platform, key: string): [any, string, boolean] { } // Custom KBD component -const KbdInternal = ({ k }: { k: string }) => { +const KbdInternal = ({ k, windows, mac, linux }: { k: string; windows?: string; mac?: string; linux?: string }) => { const { platform } = useContext(PlatformContext); - const keys = k.split(":"); + + // Determine which key binding to use based on platform overrides + let keyBinding = k; + if (platform === "windows" && windows) { + keyBinding = windows; + } else if (platform === "mac" && mac) { + keyBinding = mac; + } else if (platform === "linux" && linux) { + keyBinding = linux; + } + + const keys = keyBinding.split(":"); const keyElems = keys.map((key, i) => { const [displayKey, title, symbol] = convertKey(platform, key); return ( @@ -58,8 +69,8 @@ const KbdInternal = ({ k }: { k: string }) => { return
{keyElems}
; }; -export const Kbd = ({ k }: { k: string }) => { - return {k}
}>{() => }; +export const Kbd = ({ k, windows, mac, linux }: { k: string; windows?: string; mac?: string; linux?: string }) => { + return {k}
}>{() => }; }; export const KbdChord = ({ karr }: { karr: string[] }) => { diff --git a/frontend/app/aipanel/aipanel.tsx b/frontend/app/aipanel/aipanel.tsx index c386348b3..acc76ee5c 100644 --- a/frontend/app/aipanel/aipanel.tsx +++ b/frontend/app/aipanel/aipanel.tsx @@ -7,7 +7,7 @@ import { ErrorBoundary } from "@/app/element/errorboundary"; import { atoms, getSettingsKeyAtom } from "@/app/store/global"; import { globalStore } from "@/app/store/jotaiStore"; import { checkKeyPressed, keydownWrapper } from "@/util/keyutil"; -import { isMacOS } from "@/util/platformutil"; +import { isMacOS, isWindows } from "@/util/platformutil"; import { cn } from "@/util/util"; import { useChat } from "@ai-sdk/react"; import { DefaultChatTransport } from "ai"; @@ -135,10 +135,20 @@ const AIWelcomeMessage = memo(() => { to toggle panel
- Ctrl - Shift - 0 - to focus + {isWindows() ? ( + <> + Alt + 0 + to focus + + ) : ( + <> + Ctrl + Shift + 0 + to focus + + )}
diff --git a/frontend/app/store/keymodel.ts b/frontend/app/store/keymodel.ts index 414b3bde1..32b33abcf 100644 --- a/frontend/app/store/keymodel.ts +++ b/frontend/app/store/keymodel.ts @@ -23,6 +23,7 @@ import { TabBarModel } from "@/app/tab/tabbar-model"; import { WorkspaceLayoutModel } from "@/app/workspace/workspace-layout-model"; import { deleteLayoutModelForTab, getLayoutModelForStaticTab, NavigateDirection } from "@/layout/index"; import * as keyutil from "@/util/keyutil"; +import { isWindows } from "@/util/platformutil"; import { CHORD_TIMEOUT } from "@/util/sharedconst"; import { fireAndForget } from "@/util/util"; import * as jotai from "jotai"; @@ -606,14 +607,25 @@ function registerGlobalKeys() { return true; }); } - globalKeyMap.set("Ctrl:Shift:c{Digit0}", () => { - WaveAIModel.getInstance().focusInput(); - return true; - }); - globalKeyMap.set("Ctrl:Shift:c{Numpad0}", () => { - WaveAIModel.getInstance().focusInput(); - return true; - }); + if (isWindows()) { + globalKeyMap.set("Alt:c{Digit0}", () => { + WaveAIModel.getInstance().focusInput(); + return true; + }); + globalKeyMap.set("Alt:c{Numpad0}", () => { + WaveAIModel.getInstance().focusInput(); + return true; + }); + } else { + globalKeyMap.set("Ctrl:Shift:c{Digit0}", () => { + WaveAIModel.getInstance().focusInput(); + return true; + }); + globalKeyMap.set("Ctrl:Shift:c{Numpad0}", () => { + WaveAIModel.getInstance().focusInput(); + return true; + }); + } function activateSearch(event: WaveKeyboardEvent): boolean { const bcm = getBlockComponentModel(getFocusedBlockInStaticTab()); // Ctrl+f is reserved in most shells diff --git a/package-lock.json b/package-lock.json index 02673dbd0..9eea51de4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "waveterm", - "version": "0.13.0-beta.2", + "version": "0.13.0-beta.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "waveterm", - "version": "0.13.0-beta.2", + "version": "0.13.0-beta.3", "hasInstallScript": true, "license": "Apache-2.0", "workspaces": [