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
Format for Display API Reference

convertToModFormat

Function: convertToModFormat()

ts
function convertToModFormat(hotkey, platform): Hotkey;

Defined in: parse.ts:345

Converts a hotkey string to use 'Mod' format for portability.

On macOS, converts 'Meta' to 'Mod'. On Windows/Linux, converts 'Control' to 'Mod'. This enables cross-platform hotkey definitions that work consistently.

Parameters

hotkey

The hotkey string to convert

Hotkey | string & object

platform

The target platform (defaults to auto-detection)

"mac" | "windows" | "linux"

Returns

Hotkey

The hotkey string with 'Mod' format applied

Example

ts
convertToModFormat('Meta+S', 'mac') // 'Mod+S'
convertToModFormat('Control+S', 'windows') // 'Mod+S'
convertToModFormat('Control+Meta+S', 'mac') // 'Control+Meta+S' (both present, no conversion)