8

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.

7
  • There is a way to customise the Touch Bar, as you can see here, but as far as I'm aware there is no possible way to simulate keys with it. I don't have a new MBP though, so I wouldn't know. Have you tried enabling the Keyboard Viewer in Settings > Keyboard > Show Keyboard and Emoji Viewers in menu bar?
    – Srevilo
    Commented Mar 27, 2018 at 8:17
  • I have customized the touchbar ad read all apple official docs, apparently some apps could be able to do this but I would like confirmation of this first. I also have the souvenir of someone making a script or editing a config file for this but I cant find anything related to this.
    – Raphaël
    Commented Mar 27, 2018 at 9:02
  • I reckon the best thing for the moment would be to use the Keyboard viewer. might not be the easiest to use but it will definitely work
    – Srevilo
    Commented Mar 27, 2018 at 9:34
  • Not the answer you are looking for, but you can use an external keyboard. The Apple Magic keyboard connects wirelessly and is quite handy to carry.
    – Nimesh Neema
    Commented Mar 27, 2018 at 9:58
  • @NimeshNeema Why do I see you everywhere? XD
    – Srevilo
    Commented Mar 27, 2018 at 10:24

2 Answers 2

7

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"
1
  • 1
    Great solution! Thank you. Still working with macos 10.15.4 Commented Apr 29, 2020 at 19:58
2

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .