Community Built

Keypress Symbols

Convert keyboard shortcut names into macOS symbols, for example, Cmd + Shift + P becomes ⌘⇧P.

By Kiran Saldanha

Available in ActionClip 2.3.3. Update ActionClip before installing these actions. Download the action file, open it in ActionClip, then review it before choosing Add Action. Get ActionClip if you haven’t installed it yet.

What it does

Convert keyboard shortcut names into macOS symbols. For example, Cmd + Shift + P becomes ⌘⇧P. The action replaces matching key words throughout the selected text, so ordinary words such as “up” and “return” may also be changed. Some keys, including Esc and Space, are not converted.

How to use it

  1. Available in ActionClip 2.3.3. Update ActionClip before installing these actions.
  2. Choose Download action and open the downloaded .actionclip file.
  3. Review the action and choose Add Action.
  4. Select the text you want to use and choose Keypress Symbols.

Requirements

ActionClip with JavaScript actions enabled.

Privacy

The action processes selected text locally in ActionClip’s JavaScript sandbox.

Example

Input

Cmd + Shift + P

Output

⌘⇧P
View action source
function run(selected_text) {
  const symbols = {
    cmd: '⌘', command: '⌘', shift: '⇧', option: '⌥', alt: '⌥',
    control: '⌃', ctrl: '⌃', enter: '↩', return: '↩', tab: '⇥',
    delete: '⌫', backspace: '⌫', forwarddelete: '⌦', fn: 'fn',
    capslock: '⇪', eject: '⏏', up: '↑', down: '↓', left: '←', right: '→'
  };
  return selected_text.replace(/\b(command|cmd|control|ctrl|option|alt|shift|enter|return|tab|delete|backspace|forward[ -]?delete|caps[ -]?lock|eject|fn|up|down|left|right)\b/gi, function (match) {
    const key = match.toLowerCase().replace(/[ -]/g, '');
    return symbols[key] || match;
  }).replace(/(?:⌘|⇧|⌥|⌃)\s*\+\s*/g, function (match) {
    return match.replace(/\s*\+\s*/, '');
  });
}

Back to Community Built actions