
Hotkey
lobehub/lobehubOfficial
Step-by-step guide for registering a new keyboard shortcut across types, constants, i18n, and hooks.
- skills.sh installs
- 4.1K
- GitHub stars
- 86K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers the full registration flow:
HotkeyIdunion,HotkeyEnum,HOTKEYS_REGISTRATION, i18n translations, and a hook - Includes a tooltip pattern that displays a shortcut next to a button using
Tooltipandhotkey - Enforces
KeyEnum.Modover hardcodedCtrlorCmdand requires scope and group selection - Designed for LobeHub contributors adding or troubleshooting shortcuts with scope, conflict, or settings issues
Install
$ npx -y skills add lobehub/lobehub --skill hotkey -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Adding Keyboard Shortcuts Guide
Steps to Add a New Hotkey
1. Update Hotkey Constant
In packages/types/src/hotkey.ts, add the new id to the HotkeyId union — it's the source of truth HotkeyEnum is typed against:
export type HotkeyId =
| 'addUserMessage'
// existing...
| 'saveTopic';
2. Register Default Hotkey
In packages/const/src/hotkeys.ts, KeyEnum and combineKeys are already defined locally in this file, so no import is needed — add the entry to HotkeyEnum and to HOTKEYS_REGISTRATION:
export const HotkeyEnum = {
// existing...
SaveTopic: 'saveTopic',
} as const satisfies Record<string, HotkeyId>;
export const HOTKEYS_REGISTRATION: HotkeyRegistration = [
// existing...
{
group: HotkeyGroupEnum.Conversation,
id: HotkeyEnum.SaveTopic,
keys: combineKeys([KeyEnum.Alt, 'n']),
scopes: [HotkeyScopeEnum.Chat],
},
];
3. Add i18n Translation
In packages/locales/src/default/hotkey.ts:
const hotkey: HotkeyI18nTranslations = {
saveTopic: {
desc: '保存当前话题并新建一个话题',
title: '保存话题',
},
};
4. Create and Register Hook
Details
- Repository
- github.com/lobehub/lobehub
- Category
- Frontend & UI Code
- First seen
- Apr 16, 2026
More from lobehub/lobehub
All 21Similar to Hotkey
More Frontend & UI Code
nextjs-app-routergiuseppe-trisciuoglio/developer-kit4.1K installsProvides patterns and code examples for building Next.js 16+ applications with App Router architecture. Use when creating projects with App Router, implementing
debug-optimize-lcpchromedevtools/chrome-devtools-mcp4.1K installsGuides debugging and optimizing Largest Contentful Paint (LCP) using Chrome DevTools MCP tools. Use this skill whenever the user asks about LCP performance, slo
zod-validation-utilitiesgiuseppe-trisciuoglio/developer-kit4K installsCreates reusable Zod v4 schemas, validates API payloads, forms, and configuration input, transforms and coerces data safely, and handles validation errors with
mantine-custom-componentsmantinedev/skills4K installsBuild custom components that integrate with Mantine's theming, Styles API, and core features. Use this skill when: (1) creating a new component using factory(),
tanstack-starttanstack-skills/tanstack-skills4K installsFull-stack React framework powered by TanStack Router with SSR, streaming, server functions, and deployment to any hosting provider.
shopify-liquid-themesbenjaminsehl/liquid-skills4K installsGenerate Shopify Liquid theme code (sections, blocks, snippets) with correct schema JSON, LiquidDoc headers, translation keys, and CSS/JS patterns. Use when cre