Just as the title states, I had this pity situation where I bought a Logitech MX Keys Mini keyboard and tried to use it on any of my MacBooks. All cool and fancy, but the layout I could find for the external keyboard is INT and I’m used to working on US ones. And having the tilde/grave (~/`) key right next to Z is not something a programmer can really get used to.
Therefore, what to do?
Previously, I had been using Karabiner just to map these keys with some degrees of success. Pretty easy, but it has some very intrusive permissions to allow in order to have this app running. Used it for my personal MacBook which has the same “illness” - an INT layout - and it was doing the trick. But on the laptop I’ve got from my employer, these permissions aren’t allowed and Karabiner can’t function properly, so I needed to have a different approach.
Of course, there should be a simple fix for this case which required 2 simple steps:
- defining a Quick Action in the Automator app
- assign a keyboard shortcut for it which remaps my keys (as I might be working now using my external keyboard, then switch to the laptop’s keyboard which has the correct layout)
There’s a nice tool called hidutil that can set any remaps.
Automator quick action (type ~ “run shell script”) (save it using a relevant name):
|
|
The above script will toggle the remap on/off.
Then, you can configure a shortcut for it under Preferences > Keyboard > Shortcuts. Filter using the “Services” category and you should be able to see your quick action. I’ve used CMD+ctrl+R
.
There’s also a nice website in case you want to remap other keys. I assume even playing tricks can be quite nice.
This won’t run at startup and the change is not persistent. But at least I don’t have to return this item. Guess it should work on all recent MacOS versions.