Permanently add a special character to the Touch Bar

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"

Thanks for the tip, I used this to set up shortcuts to use Chinese pinyin characters. This script works a bit better for text rather than emojis as it preserves the format of the original:

set the clipboard to "ǎ"

tell application "System Events" to keystroke "v" using {shift down, option down, command down}