Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
API Reference
Hotkeys API Reference
Hotkey Sequence API Reference
Key Hold API Reference
Held Keys API Reference
Hotkey Recorder API Reference
Hotkey Sequence Recorder API Reference
Format for Display API Reference

normalizeHotkey

Function: normalizeHotkey()

ts
function normalizeHotkey(hotkey, platform): string;

Defined in: parse.ts:160

Normalizes a hotkey string to its canonical form.

The canonical form uses:

  • Full modifier names (Control, Alt, Shift, Meta)
  • Modifiers in order: Control+Alt+Shift+Meta
  • Uppercase letters for single-character keys
  • Proper casing for special keys (Escape, not escape)

Parameters

hotkey

The hotkey string to normalize

Key | string & object

platform

The target platform for resolving 'Mod' (defaults to auto-detection)

"mac" | "windows" | "linux"

Returns

string

The normalized hotkey string

Example

ts
normalizeHotkey('mod+shift+s') // On Mac: 'Shift+Meta+S'
normalizeHotkey('ctrl+a') // 'Control+A'
normalizeHotkey('esc') // 'Escape'