4

I want to turn off the fn keys and use them as F1, F2, etc., only for specific apps. I was able to do it on my previous Macbook Pro that had a Touchbar. On my new Macbook, with Monterey, I can only turn them off to all apps or keep them on. I thought about using Shortcuts to create an action as follows:

 When open PyCharm, turn off the fn keys. 
 When close PyCharm, turn on the fn keys. 

But this keyboard action seems to don't be available.

I'm using a MacBook Pro 16' 2021 with Monterey installed.

2 Answers 2

6

A light-weight option is to user FNSwitch:

an application designed to easily switch between FN (F1-F12 keys) and the icons apple includes on them instead.

Or Fluor:

A handy tool for macOS allowing you to switch Fn keys' mode based on active application.

For a more customizable solution you can use Karabiner Elements to create application specific key mappings via a complex rule. You can either look through existing application specific rules or create your own.

1
  • Fluor does exactly what I was looking for! Thanks Commented Jun 5, 2022 at 19:49
0

Here's the simple solution I'm using with Karabiner Elements to map Fn keys in VS Code. It doesn't support using Fn+F keys to do media functions within VS Code - I may fiddle more to add that if it gets annoying.

(I didn't get Fluor or FNSwitch to work easily for my needs on Monterey 12.6.)

{
            "description": "VS Code Function keys work as Fn keys",
            "manipulators": [
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f1",
                  "modifiers": {
                    "optional": ["any"]
                  }
                },
                "to": [
                  {
                    "key_code": "f1"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f2"
                },
                "to": [
                  {
                    "key_code": "f2"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f3"
                },
                "to": [
                  {
                    "key_code": "f3"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f4"
                },
                "to": [
                  {
                    "key_code": "f4"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f5"
                },
                "to": [
                  {
                    "key_code": "f5"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f6"
                },
                "to": [
                  {
                    "key_code": "f6"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f7"
                },
                "to": [
                  {
                    "key_code": "f7"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f8"
                },
                "to": [
                  {
                    "key_code": "f8"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f9"
                },
                "to": [
                  {
                    "key_code": "f9"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],

                "from": {
                  "key_code": "f10"
                },
                "to": [
                  {
                    "key_code": "f10"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f11"
                },
                "to": [
                  {
                    "key_code": "f11"
                  }
                ],
                "type": "basic"
              },
              {
                "conditions": [
                  {
                    "file_paths": ["Visual Studio Code\\.app"],
                    "type": "frontmost_application_if"
                  }
                ],
                "from": {
                  "key_code": "f12"
                },
                "to": [
                  {
                    "key_code": "f12"
                  }
                ],
                "type": "basic"
              }
            ]
          }

You must log in to answer this question.

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