George Garside Blog

If you find something useful on here, it's probably an accident.

Custom Characters in OS X PressAndHold.app Accent Popup

When holding down a character on the keyboard in OS X, a popup appears with accented characters that you can use. If you don’t want to remember all the keyboard shortcuts for the accents, this provides an easy way to access them. However, you can add custom characters to these popups to include your own characters and even strings by customising the PressAndHold.app.

  1. Navigate to /System/Library/Input Methods/PressAndHold.app/Contents/Resources/.

    In macOS Sierra, this path has changed. The path is now
    /System/Library/Input Methods/PressAndHold.app/Contents/PlugIns/PAH_Extension.appex/Contents/Resources/

  2. Make a backup of the relevant keyboard file for your locale. In my case, this is Keyboard-en.plist or Keyboard-en_GB.plist.
  3. Add custom characters or change the characters that you wish, then save the file.
  4. Log out and back in for the changes to take effect in all apps.

Here’s my custom characters that I’ve added to my Keyboard-en.plist. This is updated automatically when changes are made to the file on my Mac. The file is also used on my jailbroken iPhone.

<!-- q: OS X symbols -->
<key>Roman-Accent-q</key>
<dict>
 <key>Direction</key>
 <string>right</string>
 <key>Keycaps</key>
 <!-- All the symbols I need for writing answers on Ask Different! -->
 <string>⌘ ⌥ ⇧ ⌃ ⎋ ⏏ ⌫ ⇥ ↩︎ ⇞</string>
 <key>Strings</key>
 <string>⌘ ⌥ ⇧ ⌃ ⎋ ⏏ ⌫ ⇥ ↩︎ ⇞</string>
</dict>

<!-- w: arrows -->
<key>Roman-Accent-w</key>
<dict>
 <key>Direction</key>
 <string>right</string>
 <key>Keycaps</key>
 <string>→ ← ↑ ↓</string>
 <key>Strings</key>
 <string>→ ← ↑ ↓</string>
</dict>

<!-- r: misc -->
<key>Roman-Accent-r</key>
<dict>
 <key>Direction</key>
 <string>right</string>
 <key>Keycaps</key>
 <!-- That's a double prime, not speech marks
 also, the degrees celsius is a single unicode character
 I rarely use these arrows in comparison to the ones above -->
 <string>″ ✓ ✗ ▶︎ ◀︎ ℃ ©</string>
 <key>Strings</key>
 <string>″ ✓ ✗ ▶︎ ◀︎ ℃ ©</string>
</dict>

<!-- v: math symbols -->
<key>Roman-Accent-v</key>
<dict>
 <key>Direction</key>
 <string>right</string>
 <key>Keycaps</key>
 <!-- I use therefore/because and not equal to much more than any
 of the other characters here -->
 <string>× ÷ √ π ∴ ∵ ≈ ≠ ∞</string>
 <key>Strings</key>
 <string>× ÷ √ π ∴ ∵ ≈ ≠ ∞</string>
</dict>

<!-- t: unicode superscript numbers -->
<key>Roman-Accent-t</key>
<dict>
 <key>Direction</key>
 <string>right</string>
 <key>Keycaps</key>
 <string>¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁰</string>
 <key>Strings</key>
 <string>¹ ² ³ ⁴ ⁵ ⁶ ⁷ ⁸ ⁹ ⁰</string>
</dict>