0

I have a Microsoft Surface Ergonomic Keyboard paired to my MacBook Pro over Bluetooth.

Microsoft Surface Ergonomic Keyboard

macOS has detected the keyboard as an "Ergonomic Keyboard." When I go to the keyboard settings and click "Modifier Keys...", it thinks I have a 🌐 instead of Fn. But this keyboard doesn't have a 🌐 (as far as I'm aware), and it does have an Fn. Pressing Fn toggles a light on and off on the key.

Here are the "Modifier Keys..." options:

Ergonomic Keyboard Modifier Keys options

Keyboard settings:

Keyboard settings with Globe key for Start Dictation

The problem is that pressing Fn twice does not start dictation. Instead, it just toggles Fn light on and off. I'm not 100% sure how this works, but maybe this is actually just toggling an internal state inside the keyboard. Maybe it doesn't send a keypress event until you actually press one of the function keys (e.g. F1, F2), and the Fn state just determines if it sends a plain F1 key, or one of the special functions (e.g. mute, play/pause, etc.)

Is it possible to configure Fn to start dictation? Is it possible to change a setting on the keyboard to disable the Fn light turning on and off, and send a Fn / 🌐 keypress event instead?

I installed Karabiner-Elements and played around with it, but I couldn't figure out how to change the behavior of Fn or remap it. I was able to remap the right Windows as Fn, so I'm able to start dictation by pressing this key twice. But I would still be interested to know if it's possible to use the Fn.

Karabiner-Elements configuration

1 Answer 1

0

I finally figured out a decent solution with Karabiner-Elements. I just found out that it supports complex rules with variables, conditions, and delays, so I was able to customize the behavior of the Enter key on my keypad. I set up a rule that will start dictation if I press it twice, but I can still use the Enter key if I only press it once (with a short delay.)

Here is my JSON rule:

{
  "title": "Double tap keypad_enter to double tap fn (start dictation.) Single tap for keypad_enter after a short delay (250ms.)",
  "rules": [
    {
      "description": "This rule solves a problem with the Microsoft Surface Ergonomic Keyboard. The `Fn` key can't be used to start dictation, since it only toggles an internal state on and off, and it does not actually send any keypress event. This rule allows you to start dictation by double tapping the keypad enter key, which will send Fn twice. If you only press the keypad enter key once, it will send the original enter key after a short delay (250ms).",
      "manipulators": [
        {
          "conditions": [
            {
              "name": "keypad_enter pressed",
              "type": "variable_if",
              "value": 1
            }
          ],
          "from": {
            "key_code": "keypad_enter",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "fn"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "keypad_enter",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "keypad_enter pressed",
                "value": 1
              }
            },
            {
              "key_code": "fn"
            }
          ],
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 250
          },
          "to_delayed_action": {
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "keypad_enter pressed",
                  "value": 0
                }
              }
            ],
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "keypad_enter pressed",
                  "value": 0
                }
              },
              {
                "key_code": "keypad_enter"
              }
            ]
          },
          "type": "basic"
        }
      ]
    }
  ]
}

I have also submitted a PR to add this example to their documentation.

If this PR is merged then you will be able to visit https://ke-complex-modifications.pqrs.org and click the blue "Import" button to import the JSON into your Karabiner-Elements app.

https://ke-complex-modifications.pqrs.org screenshot

In the meantime, here is how you can manually import the rule.

Open a new file in your text editor, and paste the JSON above. Save the file to your home directory: ~/double_tap_keypad_enter_to_double_tap_fn.json

Open a terminal and run these commands:

mkdir -p ~/.config/karabiner/assets/complex_modifications/
mv ~/double_tap_keypad_enter_to_double_tap_fn.json ~/.config/karabiner/assets/complex_modifications/

(The ~/.config directory is usually hidden from Finder and the "Save File" window, so it's easier to use the terminal for this step.)

Go to the Complex Modifications page and click Add Rule. (You don't need to restart Karabiner-Elements if it's already running, it should find the new JSON file immediately.)

Complex Modifications => Add Rule

You should see the new rule. Click "Enable".

Enable the new rule

Finally, make sure your keyboard settings are correct. (In case you've been trying a few other things before finding this solution.)

Open the System Preferences and click "Keyboard".

Make sure the dictation shortcut is configured correctly: "Press 🌐 to Start Dictation (Press 🌐 twice)"

dictation shortcut

Side note: The Microsoft Surface Ergonomic Keyboard doesn't actually have a 🌐 Globe key, but this is just the Fn key with a different name and icon.

Now click "Modifier Keys":

keyboard modifier keys button

You should see the virtual Karabiner keyboard driver, and the Globe (🌐) key should be set to 🌐 Globe.

keyboard settings modifier keys

The rule is now active, so open your text editor and try it out. When you press the keypad enter key once, you should see a new line after a short delay. When you press it twice, it should start dictation.

Please feel free to modify this rule and choose your own key, or change all of the logic. I hope this example can help you get started with your own customizations. Make sure you check out some of the other examples in the documentation, and read the "complex modification" documentation to see all the things you can do with Karabiner-Elements.

Enjoy!

You must log in to answer this question.

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