Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change behaviour of FN keys based on foremost application using use_fkeys_as_standard_function_keys #4005

Open
yermandy opened this issue Nov 7, 2024 · 3 comments

Comments

@yermandy
Copy link

yermandy commented Nov 7, 2024

Hello, is it possible to change the behavior of FN keys based on the frontmost application?

Before v15.3.0, I had to manually set display_brightness_decrement -> f1 if a certain application was active.

Something like this:

"manipulators": [
{
    "conditions": [
        {
            "bundle_identifiers": [
                "com.microsoft.VSCode"
            ],
            "type": "frontmost_application_if"
        }
    ],
    "from": {
        "key_code": "f1",
        "modifiers": {
            "mandatory": [
                "fn"
            ]
        }
    },
    "to": [
        {
            "consumer_key_code": "display_brightness_decrement"
        }
    ],
    "type": "basic"
},
{
    "conditions": [
        {
            "bundle_identifiers": [
                "com.microsoft.VSCode"
            ],
            "type": "frontmost_application_if"
        }
    ],
    "from": {
        "key_code": "f1",
        "modifiers": {
            "optional": [
                "any"
            ]
        }
    },
    "to": [
        {
            "key_code": "f1"
        }
    ],
    "type": "basic"
}

With the new version, this approach does not work anymore. Now, I can see that there is a variable system.use_fkeys_as_standard_function_keys

Can I change the behavior of all FN keys to be (F1, F2, ...., F12) when com.microsoft.VSCode is the frontmost application using system.use_fkeys_as_standard_function_keys?

Thank you!

@lukewlms
Copy link

lukewlms commented Nov 8, 2024

Yes, here's how I now have this set up:

{
    "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",
                    "modifiers": "fn"
                }
            ],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "file_paths": ["Visual Studio Code\\.app" ],
                    "type": "frontmost_application_if"
                }
            ],
            "from": { "key_code": "f2" },
            "to": [
                {
                    "key_code": "f2",
                    "modifiers": "fn"
                }
            ],
            "type": "basic"
        },

@tekezo
Copy link
Member

tekezo commented Nov 10, 2024

Details about the function key are documented here:
https://karabiner-elements.pqrs.org/docs/help/how-to/function-keys/

@yermandy
Copy link
Author

Thank you, fixed it using the example Swap f12 and volume_increment in Google Chrome, even though, for f5 and f6 it did not work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants