Search code examples
macoskeyboard

How to prevent the typing of special characters like "~" modifying the next keyboard input?


When I type in "^" it is highlighted and waits for the next keyboard input such that if available, the next input is accented with it. For example typing in "^" and then "a" would result in "â" instead of "^a". How do I prevent this from happening?


Solution

  • I was able to solve this by creating a custom layout with the help of this post https://superuser.com/questions/665494/how-to-make-a-custom-keyboard-layout-in-os-x.

    • First downloaded Ukelele.

    • Chose my desired layout to be edited as the current layout.

    • In Ukelele, went to File -> New From Current Input Source
    • The current layout is then shown on an on-screen keyboard. All the keys that will automatically accent the next keyboard input are highlighted with a different color from the rest of the keyboard. Right Click on the highlighted key and clicked on Make Output and pressed OK.

    This makes the output of the key to the character and does not accent any following inputs. Did the same for all other highlighted keys ("Dead Keys" I think they are called).

    • Then saved the keyboard layout as a Bundle file anywhere (Remember to also change the name of the keyboard layout within the bundle. Otherwise it will have the same name as the layout you started with and may cause confusion when trying to select it)
    • Moved the saved bundle to ~/Libraray/Keyboard Layouts/
    • Selected the new layout from the Input Sources in System Preferences
    • Became a happy programmer :)