Make the command center stable and workspace-aware (#2749)
* feat(app): expand command center actions Keep command center navigation stable by revealing only clipped rows without smooth centering. Prioritize a concise default list while making workspace, Git, pane, and creation actions searchable through the existing contribution and action-policy paths. * test(app): search for query-only command action Add project is intentionally absent from the unfiltered command center. Exercise the overlay flow through search before selecting it.
This commit is contained in:
@@ -27,6 +27,7 @@ export type KeyboardActionId =
|
||||
| "workspace.pane.close"
|
||||
| "workspace.focus.toggle"
|
||||
| "workspace.terminal.new"
|
||||
| "workspace.browser.new"
|
||||
| "sidebar.toggle.right"
|
||||
| "workspace.new"
|
||||
| "workspace.project.pick"
|
||||
@@ -61,6 +62,7 @@ export type KeyboardActionDefinition =
|
||||
| { id: "workspace.pane.close"; scope: KeyboardActionScope }
|
||||
| { id: "workspace.focus.toggle"; scope: KeyboardActionScope }
|
||||
| { id: "workspace.terminal.new"; scope: KeyboardActionScope }
|
||||
| { id: "workspace.browser.new"; scope: KeyboardActionScope }
|
||||
| { id: "sidebar.toggle.right"; scope: KeyboardActionScope }
|
||||
| { id: "workspace.new"; scope: KeyboardActionScope }
|
||||
| { id: "workspace.project.pick"; scope: KeyboardActionScope }
|
||||
|
||||
@@ -6,6 +6,7 @@ import type {
|
||||
MessageInputKeyboardActionKind,
|
||||
} from "@/keyboard/actions";
|
||||
import { type KeyCombo, parseChordString } from "@/keyboard/shortcut-string";
|
||||
import { chordStringToShortcutKeys } from "@/keyboard/shortcut-string";
|
||||
|
||||
export type { KeyCombo } from "@/keyboard/shortcut-string";
|
||||
|
||||
@@ -1406,6 +1407,19 @@ export function getDefaultKeysForAction(
|
||||
return null;
|
||||
}
|
||||
|
||||
export function resolveShortcutKeysForAction(
|
||||
actionId: string,
|
||||
overrides: Readonly<Record<string, string>>,
|
||||
platform: { isMac: boolean; isDesktop: boolean },
|
||||
): ShortcutKey[][] | null {
|
||||
const bindingId = getBindingIdForAction(actionId, platform);
|
||||
if (!bindingId) return null;
|
||||
const override = overrides[bindingId];
|
||||
if (override) return chordStringToShortcutKeys(override);
|
||||
const defaultKeys = getDefaultKeysForAction(actionId, platform);
|
||||
return defaultKeys ? [defaultKeys] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `KeyboardEvent.key` whose hold reveals the sidebar workspace-jump number
|
||||
* badges. It must match the modifier of the active `workspace.navigate.index`
|
||||
|
||||
Reference in New Issue
Block a user