Permanently add a special character to the Touch Bar

keyboardtouch-bar

I have a Mid 2017 MacBook Pro 13" and the n key is broken.

Replacement process at Apple would be really complicated since I am far from maintenance centres and I need my laptop everyday (plus I have a non-default keyboard, it's a US international, spare parts are not in stock etc…)

So I wondered, until I get a real fix for my keyboard, is it possible to input the character using the Touch Bar? Could I just customise the Touch Bar to input the character n?

PS: This would be handy, I could also use this to add special characters like ë, ù or in the Touch Bar.

Best Answer

OK, I've worked out how to do this. Working nicely on my MacBook now, I now have a ? button on my Touch Bar, which types the ? symbol.

Instructions:

  1. In the app Automator, create a new Quick Action. Save the new Quick Action using a name consisting of the symbol it will represent e.g. I named mine "?". (Optional: At the top of the Quick Action window you can also choose an image which will appear in front of it on the Touch Bar, I chose the plus symbol. If you don't want one you could create a blank image and use that).

  2. In Automator, find the 'Run Applescript' action (search for it or look under Utilities) and drag it into the script area on the right.

  3. Paste the following script into it, replacing the "thumbs up" symbol with your desired character.

    set the clipboard to "?"
    tell application "System Events" to keystroke "v" using command down
  1. Save the new Quick Action you have created.

  2. Go to System Preferences --> Keyboard --> Keyboard and either: a) set "Touch Bar shows: Quick Actions" (this will make the new icon appear on the touch bar immediately), or b) use Customise Touch Bar to add the Quick Actions icon to the touch bar (this will make the new icon appear on the touch bar when you press the Quick Actions icon).

  3. Icon should appear on Touch Bar. Press it and an error message will appear.

  4. Cancel the error message then go to System Preferences --> Security and Privacy --> Privacy --> Accessibility. Click the lock to make changes (if necessary) and under "Allow the apps below to control your computer" tick the new one which should have appeared named "ServicesUIAgent".

Done!

Screenshot showing how to use Automator to add a unicode symbol to the Touch Bar

NB The method above should work for any Unicode character including the special characters you suggest (obviously you could also use it for multiple characters, any text string that'll go on the clipboard should be ok), but if you only want the letter "n" then the script can just say:

keystroke "n"