3

I've recently switched from Windows/Ubuntu to MacOS Catalina and I'm trying to avoid changing too many key mappings on Intellij 2020.2.

I'm trying to achieve these things:

  1. Swap Left Ctrl and Fn
  2. Having function keys as default in touch bar when using Intellij to be able to use combinations like Ctrl + F4 in Intellij without having to press any additional (Fn) keys
  3. (If possible) Map Ctrl + click to something other than Right Click

Here's what I've done so far:

  1. Swap Left Ctrl and Fn using Karabiner
  2. System Preferences > Keyboard > Shortcuts > Function Keys > Add Intellij
  3. Imported a complex modification in Karabiner to change Ctrl + click to just click.

The issues that I'm facing:

  1. Pressing original Fn (mapped to Left Ctrl) in Intellij changes touch bar from Function keys to other touch bar options. I'd like to disable this to be able to use Ctrl+F4.
  2. Left Ctrl+Click still behaves as right click.
3
  • 1
    Similar questions have been asked on how to remap keys to emulate Windows key combinations. The general consensus is don't. Developers write apps with the expectation of keys doing certain things and attempting to remap them en masse can cause lots of issues like what you're seeing with the Touch Bar - that's probably just the tip of the iceberg. Take some time and get used to the key mappings, you'll adapt quicker than you expect.
    – Allan
    Commented Oct 20, 2020 at 17:58
  • I actually never adapted to Mac's shortcuts, as I continued using a Windows machine at home, while using a Mac at school. So while you continue using Windows or Linux, your muscle memory will keep getting in the way.
    – DWilches
    Commented Sep 29, 2021 at 14:32
  • I have used NeXT (which uses Apple keys) and Windows machines since 1996 and quickly switch between them.
    – mmmmmm
    Commented Oct 29, 2021 at 16:10

1 Answer 1

2

You can edit the Karabiner rules to ignore IntelliJ completely, then, you can use IntelliJ's keymaps to change keys as you want.

You can also create your own rules in Karabiner to remap keys for IntelliJ if you want.

The Karabiner config file is located in ~/.config/karabiner/karabiner.json, and editing it is not to complex, you can use comparators like frontmost_application_unless and frontmost_application_if to select which app the keymap applies to.

What I did was to import some predefined keymaps to understand the file format, and use them as examples for modifying the ones I was interested in.

For example, for Ctrl+C it was this, so you can adapt it for your needs:

{
  "description": "Copy Command (Except IntelliJ IDEs)",
  "manipulators": [
    {
      "conditions": [
        {
          "bundle_identifiers": [
            "^com\\.jetbrains\\..*$"
          ],
          "type": "frontmost_application_unless"
        }
      ],
      "from": {
        "key_code": "c",
        "modifiers": {
          "mandatory": [
            "control"
          ],
          "optional": [
            "any"
          ]
        }
      },
      "to": [
        {
          "key_code": "c",
          "modifiers": [
            "left_command"
          ]
        }
      ],
      "type": "basic"
    }
  ]
}

You must log in to answer this question.

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