Ctrlifying mac shortcuts

I always forget how to do this. Then I go through a month or so desperately trying to remember how to open new browser tabs in Chrome, tabbing between applications and so on using the keyboard shortcuts.

My (very real to me) problem is that I use a keyboard where the Ctrl key is conveniently placed under one of my thumbs, while the Super/Cmd key is not.

The workaround I describe here makes it easier for me to switch between OS X and Linux.

Steps:

  1. Download and install Karabiner Elements

  2. For inspiration, browser the “Official rules site”. Try searching for something like “PC style copy” or “Windows shortcuts on macOS”.

    Import the ruleset that looks closest to what we want to karabiner-elements.

  3. Go through the JSON in your local karabiner.json and make your changes. Monitor the karabiner-elements log as you make changes to ensure you are not breaking anything. Check the config file into Git to make it easier to roll back to a previous version if you do.

    For me I want to ensure that I do not allow these modifications to make it to Emacs and VS Code, where I use Emacs-style shortcuts and not CUA.

    Note that we see there is “filter logic” showing when a rule will be applied:

    ...
    "conditions": [
      {
        "type": "frontmost_application_unless",
    ...
    

    This is what we have to tweak to avoid the rule being applied to Emacs and VS Code. From https://karabiner-elements.pqrs.org/docs/json/complex-modifications-manipulator-definition/conditions/frontmost-application/ we see that we can select applications based on bundle identifier or file paths.

    We see that we can use Karabiner to view the bundle identifier for the currently installed apps: https://karabiner-elements.pqrs.org/docs/json/complex-modifications-manipulator-definition/conditions/frontmost-application/#investigate-the-bundle-identb

    This gives us the following bundle identifiers:

    • org.gnu.Emacs for Emacs
    • com.microsoft.VSCode for VS Code

    Knowing this and using the existing karabiner.json as a start, we customize so that we have our special “ctrl/cmd” logic applied for applications outside Emacs/VSCode.

    Once we are happy editing karabiner.json, I extract the “rules” array to a separate file in ~/.config/karabiner/assets/complex_modifications/mac-tweaks.json to make it easier to toggle these rules on and off in the future.

    In the end I ended up with the following rules, where some of them are copies/modifications on top of https://ke-complex-modifications.pqrs.org/#pc_shortcuts: