Skip to content

About

Compose key for macOS: tap right Option, then type a short sequence like ' e for é. No third-party apps, just hidutil and DefaultKeyBinding.dict.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mac compose key

A compose key for macOS on a QWERTY layout: tap the right alt (Option) key, then type a short sequence to insert an accented letter or symbol. For example, alt + ' + e types é.

Unlike a dead key, the keys of a sequence can be typed in any order (alt + e + ' also types é), and nothing needs to be held down.

It works without any third-party software:

  • A LaunchAgent runs hidutil at login to remap right alt to F13, a key nothing on macOS uses.
  • ~/Library/KeyBindings/DefaultKeyBinding.dict tells macOS what to type after F13. It also makes Home and End move to the start and end of the line.

Install

./install.sh

Then restart any open apps so they pick up the key bindings. Running it again reinstalls, e.g. after changing the bindings.

To remove everything:

./uninstall.sh

Both scripts replace the whole hidutil key mapping and the whole DefaultKeyBinding.dict, so any other remaps or key bindings you had there are lost.

Sequences

For uppercase, type the letter with Shift: alt + ' + E types É.

Keys Result Uppercase
alt + ' + e é É
alt + ^ + a, or alt + 6 + a â Â
alt + ^ + e, or alt + 6 + e ê Ê
alt + ^ + i, or alt + 6 + i î Î
alt + ^ + o, or alt + 6 + o ô Ô
alt + ^ + u, or alt + 6 + u û Û
alt + ` + a à À
alt + ` + e è È
alt + ` + i ì Ì
alt + ` + o ò Ò
alt + ` + u ù Ù
alt + " + a ä Ä
alt + " + e ë Ë
alt + " + i ï Ï
alt + " + o ö Ö
alt + " + u ü Ü
alt + ~ + n, or alt + ` + n ñ Ñ
alt + , + c ç Ç
alt + a + e (in this order) æ Æ
alt + o + e (in this order) œ Œ
alt + o + / ø Ø
alt + s + s ß
alt + = + e, or alt + = + c €
alt + o + c ©
alt + o + r ®
alt + o + o °
alt + . + . + . …
alt + - + - —
alt + < + < «
alt + > + > »
alt + = + / ≠
alt + < + = ≤
alt + > + = ≥
alt + ^ + 2 ²
alt + ^ + 3 ³
alt + - + > →
alt + < + - ←

Other keys

Keys Action macOS default
Home Start of line Scroll to top of document
End End of line Scroll to bottom of document
Shift + Home Select to start of line Select to start of document
Shift + End Select to end of line Select to end of document

On a Mac laptop, Home and End are Fn + ← and Fn + →.

Changing the bindings

Sequences and key bindings live in bindings.yml. After editing it, regenerate the key bindings file and reinstall:

bin/generate_bindings.rb > Library/KeyBindings/DefaultKeyBinding.dict
./install.sh

The generator uses the Ruby that ships with macOS. It adds uppercase sequences automatically, and stops with an error if a sequence is the start of another (e.g. -- and ---) or two sequences produce different results.

Limitations

Key bindings only work in apps built on the native macOS text system, such as TextEdit, Mail, Notes and Safari. They don't work in Electron apps (VS Code, Slack, Discord), JetBrains IDEs, and some other cross-platform apps.

About

Compose key for macOS: tap right Option, then type a short sequence like ' e for é. No third-party apps, just hidutil and DefaultKeyBinding.dict.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages