Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(webv2): bind mod+, to open settings
joshistoastd8018314d1b3
diff --git a/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.test.ts b/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.test.tsindex 4517d1b25b..cf1f857846 100644--- a/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.test.ts+++ b/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.test.ts@@ -7,8 +7,8 @@ describe('firstPartyHotkeyCatalog', () => {// 91 legacy-parity entries + `canvas.newSession` (webv2 new-canvas command,// no default keys — Task 46) + `app.openCommandPalette` (webv2-only, mod+k)// + the six top-bar redesign commands (alt+mod+enter, mod+p, an unbound save,- // and alt+1..3).- expect(firstPartyHotkeyCatalog).toHaveLength(99);+ // and alt+1..3) + `app.openSettings` (mod+,).+ expect(firstPartyHotkeyCatalog).toHaveLength(100);expect(firstPartyHotkeyCatalog.map((hotkey) => hotkey.id)).toContain('app.invoke');expect(firstPartyHotkeyCatalog.map((hotkey) => hotkey.id)).toContain('app.openCommandPalette');expect(firstPartyHotkeyCatalog.map((hotkey) => hotkey.id)).toContain('canvas.mergeDown');@@ -29,6 +29,12 @@ describe('firstPartyHotkeyCatalog', () => {);});+ it('binds settings to the platform-standard shortcut, reachable from a text field', () => {+ const openSettings = firstPartyHotkeyCatalog.find((hotkey) => hotkey.id === 'app.openSettings');++ expect(openSettings).toMatchObject({ allowInEditable: true, defaultKeys: ['mod+,'], implemented: true });+ });+it('keeps layout saving explicit and out of editable controls', () => {const saveLayout = firstPartyHotkeyCatalog.find((hotkey) => hotkey.id === 'app.saveLayoutPreset');diff --git a/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.ts b/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.tsindex 9002c64b9a..9a6219a105 100644--- a/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.ts+++ b/invokeai/frontend/webv2/src/workbench/hotkeys/catalog.ts@@ -17,6 +17,7 @@ const implemented = new Set(['app.invokeFront','app.invokeToOtherDestination','app.openProjectSwitcher',+ 'app.openSettings','app.promptHistoryNext','app.promptHistoryPrev','app.promptWeightDown',@@ -87,6 +88,9 @@ const editableAppHotkeys = new Set(['app.invokeFront','app.invokeToOtherDestination','app.openProjectSwitcher',+ // Settings is a global destination with no meaning inside a text field, so+ // the caret's location should not decide whether it opens.+ 'app.openSettings','app.promptHistoryNext','app.promptHistoryPrev','app.promptWeightDown',@@ -142,6 +146,9 @@ export const firstPartyHotkeyCatalog: HotkeyDefinition[] = [hotkey('app', 'invokeToOtherDestination', ['alt+mod+enter']),hotkey('app', 'invokeFront', ['mod+shift+enter']),hotkey('app', 'openProjectSwitcher', ['mod+p']),+ // `mod` rather than a literal ctrl: this is ⌘, on macOS and ctrl+, elsewhere,+ // which is the platform-standard settings shortcut on both.+ hotkey('app', 'openSettings', ['mod+,']),hotkey('app', 'saveLayoutPreset', []),hotkey('app', 'selectComposePreset', ['alt+1']),hotkey('app', 'selectEditPreset', ['alt+2']),diff --git a/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts b/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.tsindex c3eb62025f..4572fb3f1c 100644--- a/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts+++ b/invokeai/frontend/webv2/src/workbench/hotkeys/firstPartyCommands.ts@@ -21,6 +21,7 @@ import { useQueryClient } from '@tanstack/react-query';import { submitActiveInvocation } from '@workbench/activeInvocationSubmission';import { builtInLayoutPresetDescriptors } from '@workbench/layoutPresets';import { toggleCommandPalette } from '@workbench/palette/paletteStore';+import { openWorkbenchSettings } from '@workbench/settings/settingsDialogStore';import { getWorkbenchPreferences } from '@workbench/settings/store';import { openProjectSwitcher } from '@workbench/shell/topbar/projectSwitcherStore';import { openWidgetPlacement } from '@workbench/widgetPlacementCommands';@@ -49,6 +50,7 @@ export const FIRST_PARTY_APP_COMMAND_IDS = ['app.invokeToOtherDestination','app.openCommandPalette','app.openProjectSwitcher',+ 'app.openSettings','app.saveLayoutPreset',...layoutPresetCommands.map(({ id }) => id),'app.cancelQueueItem',@@ -175,6 +177,11 @@ export const useRegisterFirstPartyCommands = () => {id: 'app.openProjectSwitcher',title: 'Open project switcher',}),+ commandApi.register({+ handler: () => openWorkbenchSettings(),+ id: 'app.openSettings',+ title: 'Open settings',+ }),commandApi.register({handler: () => layout.savePreset(queries.getSnapshot().activeProject.layout.presetId),id: 'app.saveLayoutPreset',diff --git a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsx b/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsxindex d1a9f8ec6c..3076ece521 100644--- a/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsx+++ b/invokeai/frontend/webv2/src/workbench/palette/WorkbenchCommandPaletteDialog.tsx@@ -26,7 +26,7 @@ import { useTranslation } from 'react-i18next';import type { PaletteEntry, PaletteSearchProvider, SettingsEntryDeps } from './entries';import { CommandPaletteDialog } from './CommandPaletteDialog';-import { buildCatalogCommandEntries, buildOpenSettingsEntry, buildSettingsEntries } from './entries';+import { buildCatalogCommandEntries, buildOpenSettingsEntry, buildSettingsEntries, getEntryKeys } from './entries';import { buildExtensionPaletteEntry, createExtensionSearchProvider } from './extensionPaletteAdapters';import {createBoardsProvider,@@ -37,8 +37,8 @@ import {createWorkflowsProvider,} from './paletteProviders';-const buildStaticAppEntries = (t: TFunction): PaletteEntry[] => [- buildOpenSettingsEntry(t, () => openWorkbenchSettings()),+const buildStaticAppEntries = (t: TFunction, settingsKeys: string[] | undefined): PaletteEntry[] => [+ buildOpenSettingsEntry(t, () => openWorkbenchSettings(), settingsKeys),{group: 'App',groupLabel: t('commandPalette.groups.app'),@@ -114,7 +114,14 @@ const WorkbenchCommandPaletteDialog = ({...paletteContributions.map((contribution) =>buildExtensionPaletteEntry(contribution, extensions.commands.executeForSource)),- ...buildStaticAppEntries(t),+ ...buildStaticAppEntries(+ t,+ getEntryKeys(+ catalog.find((definition) => definition.id === 'app.openSettings'),+ preferences.customHotkeys,+ formatHotkey+ )+ ),...buildSettingsEntries(preferences, settingsEntryDeps, t),],[diff --git a/invokeai/frontend/webv2/src/workbench/palette/entries.ts b/invokeai/frontend/webv2/src/workbench/palette/entries.tsindex 75c9cf6ae5..d9dfa296fd 100644--- a/invokeai/frontend/webv2/src/workbench/palette/entries.ts+++ b/invokeai/frontend/webv2/src/workbench/palette/entries.ts@@ -156,6 +156,9 @@ const groupRank = (group: string): number => {*/const PALETTE_HIDDEN_COMMANDS = new Set(['app.openCommandPalette',+ // Both palettes already ship `buildOpenSettingsEntry` under this id, and it+ // carries search keywords and an empty-state slot the catalog entry lacks.+ 'app.openSettings','app.promptWeightDown','app.promptWeightUp','canvas.nextEntity',@@ -212,11 +215,15 @@ const WIDGET_CATEGORY_GROUPS: Record<string, { group: string; typeId: string }>workflows: { group: 'Workflows', typeId: 'workflow' },};-const getEntryKeys = (- definition: HotkeyDefinition,+export const getEntryKeys = (+ definition: HotkeyDefinition | undefined,customHotkeys: CustomHotkeys,formatHotkey: (key: string) => string[]): string[] | undefined => {+ if (!definition) {+ return undefined;+ }+const keys = customHotkeys[definition.id] ?? definition.defaultKeys;return keys[0] ? formatHotkey(keys[0]) : undefined;@@ -313,12 +320,17 @@ export interface SettingsEntryDeps {themes: ReadonlyArray<{ id: WorkbenchPreferences['themeId']; label: string }>;}-/** The "Open Settings" entry shared verbatim by both palette hosts. */-export const buildOpenSettingsEntry = (t: TFunction, openSettings: () => void): PaletteEntry => ({+/**+ * The "Open Settings" entry shared verbatim by both palette hosts. `keys` is+ * the resolved `app.openSettings` shortcut, which only the editor binds — the+ * Launchpad has no hotkey catalog, so it omits the hint.+ */+export const buildOpenSettingsEntry = (t: TFunction, openSettings: () => void, keys?: string[]): PaletteEntry => ({group: 'App',groupLabel: t('commandPalette.groups.app'),id: 'app.openSettings',isPersistentRecent: true,+ keys,keywords: 'preferences options',run: openSettings,showInEmptyState: true,diff --git a/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.tsx b/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.tsxindex a168bb914f..f5665a92f4 100644--- a/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.tsx+++ b/invokeai/frontend/webv2/src/workbench/shell/topbar/AppMenu.tsx@@ -8,11 +8,8 @@ import { MenuContent } from '@platform/ui/Menu';import { Tooltip } from '@platform/ui/Tooltip';import { useNavigate } from '@tanstack/react-router';import { OPEN_COMMAND_PALETTE_HOTKEY } from '@workbench/hotkeys/catalog';-import { formatHotkeyForPlatform } from '@workbench/hotkeys/keys';-import { applyCustomHotkeys } from '@workbench/hotkeys/resolve';import { openCommandPalette } from '@workbench/palette/paletteStore';import { openWorkbenchSettings } from '@workbench/settings/settingsDialogStore';-import { useWorkbenchPreferenceSelector } from '@workbench/settings/store';import { useOpenWorkbenchWidget } from '@workbench/useOpenWorkbenchWidget';import { useActiveProjectId, useActiveProjectSelector } from '@workbench/WorkbenchContext';import {@@ -30,6 +27,8 @@ import {import { useCallback } from 'react';import { useTranslation } from 'react-i18next';+import { useTopbarShortcut } from './useTopbarShortcut';+const MENU_POSITIONING = { placement: 'bottom-start' } as const;const DOCS_URL = 'https://invoke-ai.github.io/InvokeAI/';const DISCORD_URL = 'https://discord.gg/ZmtBAhwWhy';@@ -113,7 +112,7 @@ export const AppMenu = () => {<Menu.Separator /><HStack gap="0.5" px="1" py="0.5"><SearchMenuAction />- <AppMenuAction icon={SettingsIcon} label={t('common.settings')} value="settings" onClick={openSettings} />+ <SettingsMenuAction onClick={openSettings} /><AppMenuLinkhref={DOCS_URL}icon={BookOpenTextIcon}@@ -166,16 +165,31 @@ const AppMenuGlyph = () => (const SearchMenuAction = () => {const { t } = useTranslation();- const customHotkeys = useWorkbenchPreferenceSelector((preferences) => preferences.customHotkeys);- const firstHotkey = applyCustomHotkeys(OPEN_COMMAND_PALETTE_HOTKEY, customHotkeys).keys[0];- const hotkeyLabel = firstHotkey ? formatHotkeyForPlatform(firstHotkey).join('+') : null;- const label = hotkeyLabel- ? t('commandPalette.buttonTooltip', { hotkey: hotkeyLabel })- : t('commandPalette.buttonLabel');+ // Same formatter as every other shortcut hint in the top bar, so the two+ // hinted actions in this row read alike (and macOS gets ⌘K, not "cmd+k").+ const shortcut = useTopbarShortcut(OPEN_COMMAND_PALETTE_HOTKEY.commandId);+ const label = shortcut ? t('commandPalette.buttonTooltip', { hotkey: shortcut }) : t('commandPalette.buttonLabel');return <AppMenuAction icon={SearchIcon} label={label} value="command-palette" onClick={openCommandPalette} />;};+const SettingsMenuAction = ({ onClick }: { onClick: () => void }) => {+ const { t } = useTranslation();+ // Reads the effective binding, so a remapped or unbound shortcut is never+ // advertised as one that still works.+ const shortcut = useTopbarShortcut('app.openSettings');+ const label = t('common.settings');++ return (+ <AppMenuAction+ icon={SettingsIcon}+ label={shortcut ? `${label} (${shortcut})` : label}+ value="settings"+ onClick={onClick}+ />+ );+};+// Sized like the 2xs icon buttons in widget headers; menu items default to a// much roomier padding than an icon-only action needs.const FOOTER_ITEM_PROPS = {