Customize accents when holding down a key

I just noticed that if I hold down a key in mac when typing, that I get some custom bar that let's me choose between accents.

I'm a mathematician, and I like writing unicode math symbols directly (like α). Is there a way that I can customise the toolbar that pops-up, so that I can put my own mathematical unicode symbols in this toolbar ?


Solution 1:

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

  2. Backup the Keyboard-en.plist file.

  3. Append the following to the Keyboard-en.plist file (before the closing </dict></plist>), changing the keycaps to be your desired space-delimited list of characters.

    <key>Roman-Accent-t</key>
    <dict>
        <key>Direction</key>
        <string>right</string>
        <key>Keycaps</key>
        <string>× ÷ √ π ∴ ∵ ≈ ≠ ∞</string>
        <key>Strings</key>
        <string>× ÷ √ π ∴ ∵ ≈ ≠ ∞</string>
    </dict>
    

Feel free to change the Roman-Accent-t to any character you wish, providing it does not already have Press & Hold keys assigned. Also see shortening the Press & Hold time if you're using it regularly.