
Hotkey
This walks Claude through LobeHub's five-step hotkey registration flow, from adding an enum in HotkeyEnum through wiring up useHotkeyById hooks and rendering tooltips. It's built for when you're adding keyboard shortcuts to a LobeHub fork or extension and need the full pattern: type definitions, HOTKEYS_REGISTRATION with combineKeys, i18n strings, custom hooks, and UI integration. The guide covers scoping (chat vs global), conflict checking, and platform-agnostic key combos using Key.Mod instead of hardcoded Cmd or Ctrl. It's narrow in scope but thorough. If you're working in a different codebase or just need generic hotkey advice, this won't help. It's LobeHub-specific down to the file paths.
- skills.sh installs
- 1.3K
- GitHub stars
- 79.8K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add lobehub/lobe-chat --skill hotkey --agent claude-codeInstalls into .claude/skills of the current project.
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
Sponsors
Details
- Repository
- github.com/lobehub/lobe-chat
- First seen
- May 16, 2026