a smol miscellanea

Remapping MacBook Keys With Karabiner-Elements

I write in UK English 99% of the time and am constantly STYMIED by the Norwegian layout on my MacBook Pro. So I changed stuff. Using Karabiner-Elements, I remapped a few keys and now my apostrophes are where they should be.

At first, I struggled to make some of the changes I wanted, but once I changed the Virtual Keyboard → Keyboard Type to ANSI rather than ISO everything worked as I wanted. I presumably do have an ISO keyboard, but not according to Karabiner…? shrug

Once Keyboard Type was correct, I simply created a new rule in Complex Modifications and added the relevant JSON.

Hyper Key: Change caps_lock to control+option+shift

I first read about Hyper Keys on Brett Terpstra's blog and have used one ever since. In that post he writes about a “full” Hyper Key, i.e. a single key press equivalent to simultaneous Control [⌃] + Shift [⇧] + Option [⌥] + Command [⌘].

I used this happily for years until I saw a brilliant toot by Carlo Zottmann which mentions a modified Hyper Key that omits the Command [⌘] key. Ever since, I’ve used a modified version.

The downside to doing this is needing to use Karabiner. Raycast, BetterTouchTool or HyperKey all offer easy Hyper Keys, but as far as I’m aware, none of them allow you to strip out one of the canonical four keys. Screenshot from Karabiner-Elements showing the relevant JSON

{
    "manipulators": [
        {
            "description": "Hyperkey: Change caps_lock to control+option+shift.",
            "from": {
                "key_code": "caps_lock",
                "modifiers": { "optional": ["any"] }
            },
            "to": [
                {
                    "key_code": "left_shift",
                    "modifiers": ["left_control", "left_option"]
                }
            ],
            "type": "basic"
        }
    ]
}

Map Apostrophe to @ Key on KB

Maps the apostrophe sign to the physical @ key. Screenshot from Karabiner-Elements showing the relevant JSON

{
    "description": "Map apostrophe to @ key on KB",
    "manipulators": [
        {
            "from": {
                "key_code": "backslash",
                "modifiers": {
                    "mandatory": [],
                    "optional": []
                }
            },
            "to": [
                {
                    "key_code": "non_us_backslash",
                    "modifiers": []
                }
            ],
            "type": "basic"
        }
    ]
}

Change KB @ to right_option+2

Triggers the @ sign by pressing 2 + Right Option [⌥] Screenshot from Karabiner-Elements showing the relevant JSON

{
    "description": "Change KB @ to right_option+2",
    "manipulators": [
        {
            "from": {
                "key_code": "2",
                "modifiers": {
                    "mandatory": ["right_option"],
                    "optional": ["any"]
                }
            },
            "to": [
                {
                    "key_code": "backslash",
                    "modifiers": []
                }
            ],
            "type": "basic"
        }
    ]
}

#Blog Post #Hyper Key #Karabiner Elements #macOS