Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(shortcuts): add showInSettings flag to ShortcutDefinition (#44997)

Ali Waseema7341c70eac6
diff --git a/apps/studio/components/interfaces/Account/Preferences/HotkeySettings.tsx b/apps/studio/components/interfaces/Account/Preferences/HotkeySettings.tsx
index 9eedb7b4809..c3b6f3eb759 100644
--- a/apps/studio/components/interfaces/Account/Preferences/HotkeySettings.tsx
+++ b/apps/studio/components/interfaces/Account/Preferences/HotkeySettings.tsx
@@ -11,7 +11,9 @@ import {
import { HotkeyToggle } from './HotkeyToggle'
import { SHORTCUT_DEFINITIONS } from '@/state/shortcuts/registry'
-const SHORTCUT_ORDER = Object.values(SHORTCUT_DEFINITIONS)
+const SHORTCUT_ORDER = Object.values(SHORTCUT_DEFINITIONS).filter(
+ (definition) => definition.showInSettings !== false
+)
export const HotkeySettings = () => {
return (
diff --git a/apps/studio/state/shortcuts/types.ts b/apps/studio/state/shortcuts/types.ts
index 8ee1cd3249b..76b5d46db90 100644
--- a/apps/studio/state/shortcuts/types.ts
+++ b/apps/studio/state/shortcuts/types.ts
@@ -77,4 +77,14 @@ export interface ShortcutDefinition {
* is overridable by the caller of `useShortcut`.
*/
options?: ShortcutOptions
+
+ /**
+ * Whether this shortcut appears as a toggleable entry in Account →
+ * Preferences → Keyboard shortcuts. Defaults to `true`.
+ *
+ * Set to `false` for shortcuts that users shouldn't be able to disable (e.g.
+ * the command menu opener) or for shortcuts that aren't meaningful as a
+ * standalone user preference.
+ */
+ showInSettings?: boolean
}