Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

527 B
Raw Blame
const MODIFIERS = new Set(['Control', 'Alt', 'Shift', 'Meta']);

export function accelerator(event: React.KeyboardEvent): string | null {
  if (MODIFIERS.has(event.key)) return null;
  const held: string[] = [];
  if (event.metaKey) held.push('Super');
  if (event.ctrlKey) held.push('Control');
  if (event.altKey) held.push('Alt');
  if (event.shiftKey) held.push('Shift');
  if (held.length === 0) return null;
  const key = event.key.length === 1 ? event.key.toUpperCase() : event.key;
  return [...held, key].join('+');
}