You can export and import configuration by copying karabiner.json file to another machine. Export Open config folder from Preferences Misc. Configuration folder will be opened by Finder. Copy the karabiner.json file. Import Open config folder from Preferences Misc. Replace karabiner.json with the exported file. (The configuration file will be reloaded automatically.). I have a macbook pro 10.15.7, Karabiner Elements 13.1.0, my external AZERTY mac keyboard type is ISO european. When i type a m q w z in the Input area window of the EventViewer I get q, a z w in the. Karabiner-Elements stopped working after macOS update Touch Bar does not change to f1-f12 when I press the fn key Control-eject shortcut does not work when Karabiner-Elements is running. I added these commands to make it easy for @dyyce to kick start his Karabiner-Elements configuration. Anyway, touch filename creates a file if it does not exists. If the file exists, touch changes the file's access and modification times. Touch karabiner.json creates the file.
Hammerspoon is a OS X utility that provides a highlevel of customisation to control the working environment. Using it, one canspecify configuration where events such as mouse clicks and drags, and keyboardshortcuts can be used to trigger scripts or alter the environment as oneprefers.
Karabiner Elements Config File Viewer
For many, the caps lock key is one of the most useless keys on modernkeyboards; rarely used, it is one of the largest buttons on a keyboard withlittle useful functionality.
On the other hand, the new Macbook Pros have eliminated the escape key, one ofthe most important keys for a vim user, replacing it withthe touch bar. While the escape “key” would still be present on the touch bar,there is something reassuring about pressing a physical escape button.
An ideal solution to this is to replace the functionality of the caps lock keywith the escape key. Rather than trying to hit the missing escape key, it ispossible to map the escape key to the caps lock key, allowing for less handmovement, as well as a experiencing the tactile feedback of an actual key,rather than the touch bar.
Mapping the caps lock key to escape is fairly easy in OS X. Under SystemPreferences, Keyboard, Modifier Keys, the option to use Escape key as theaction to perform when the caps lock key is pressed.
Hammerspoon andKarabiner-Elements take this toa whole new level however, by allowing the caps lock key to function as anescape key when pressed alone, and also acting as a “hyper” key whenpressed in conjunction with other keys. This “hyper” key opens up so many morepossibilities, for having global or application specific function keys,especially when combined with Hammerspoon.
The first element (pun intended) in this setup is the configuration forKarabiner-Elements. The following code JSON should be saved in a file in
~/.config/karabiner/karabiner.json. This config remaps the caps lock key tosend the escape key when pressed alone, while sending the command, control andoption keys when pressed in conjunction with other keys.
The following Hammerspoon configuration should be saved to
Karabiner Elements Config File Opener
hyper as the combination of command, control and option beingpressed at the same time, which has been remapped to the caps lock key.
shyper is defined as the same combination, in addition with the shift key.
There are various utility functions defined, then the main
shyper keybindings are specified.
For now, there are simple terminal, firefox and finder window launching, aswell as a quick shortcut for putting the computer’s display to sleep.
Hammerspoon is not only limited to launching commands triggered by keystrokes.There is a section devoted to window layout, sending windows to various gridlocations. If you imagine a screen being split into 4 quadrants, there arevarious key bindings (in association with the caps lock/hyper remapping) tosend windows to occupy various quadrants. This allows a focused window to bequickly mapped to a region of the screen.
There is also a section devoted to using the mouse to control layout ofwindows. By grabbing the title bar of a window and dragging to either the edgeor corner of the screen, the related window will be resized and positionedappropriately.
Concluding the configuration, there are a few miscellaneous items and commentsfor future plans :)
My configuration for Karabiner-Elements, Hammerspoon and other utilities can be downloaded from my github config repository.
- More Hammerspoon sample configurations
- A Modern Space Cadet An excellent writeup of one user’s extensive custom configuration