From 476eaa0e2a56a40a3352ada2ece692e922bb2ed0 Mon Sep 17 00:00:00 2001 From: Roo Code Date: Tue, 5 Aug 2025 11:21:23 +0000 Subject: [PATCH] feat: add Cmd+R/Ctrl+R keyboard shortcut for new task MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added keybinding configuration in package.json for roo-cline.newTask command - Created utility function to detect OS and format keyboard shortcuts - Updated ChatView.tsx to display keyboard shortcut in tooltip - Shortcut shows as ⌘R on Mac and Ctrl+R on Windows/Linux --- src/package.json | 9 +++++++ webview-ui/src/components/chat/ChatView.tsx | 5 ++-- webview-ui/src/utils/keyboardShortcuts.ts | 30 +++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 webview-ui/src/utils/keyboardShortcuts.ts diff --git a/src/package.json b/src/package.json index d35f6f34dd..93974dd86f 100644 --- a/src/package.json +++ b/src/package.json @@ -312,6 +312,15 @@ "label": "%views.terminalMenu.label%" } ], + "keybindings": [ + { + "command": "roo-cline.newTask", + "key": "cmd+r", + "mac": "cmd+r", + "win": "ctrl+r", + "linux": "ctrl+r" + } + ], "configuration": { "title": "%configuration.title%", "properties": { diff --git a/webview-ui/src/components/chat/ChatView.tsx b/webview-ui/src/components/chat/ChatView.tsx index 1fe93eb470..06160276b9 100644 --- a/webview-ui/src/components/chat/ChatView.tsx +++ b/webview-ui/src/components/chat/ChatView.tsx @@ -9,6 +9,7 @@ import { LRUCache } from "lru-cache" import { useDebounceEffect } from "@src/utils/useDebounceEffect" import { appendImages } from "@src/utils/imageUtils" +import { getNewTaskShortcut } from "@src/utils/keyboardShortcuts" import type { ClineAsk, ClineMessage } from "@roo-code/types" @@ -1897,7 +1898,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction= 0 || navigator.userAgent.toUpperCase().indexOf("MAC") >= 0 + + if (isMac) { + // Use ⌘ symbol for Mac + return `⌘${commandKey.toUpperCase()}` + } else { + // Use Ctrl for Windows/Linux + return `Ctrl+${commandKey.toUpperCase()}` + } +} + +/** + * Gets the formatted keyboard shortcut for the new task command + * @returns Formatted keyboard shortcut + */ +export function getNewTaskShortcut(): string { + return getKeyboardShortcut("r") +}