Skip to content

Karabiner-Elements and EventViewer do not register Java executable as frontmost application #4499

Description

@jintakhan

Details

Hello,

I am trying to create a complex modification that automatically switches profiles when a Java-based Steam game is the active frontmost application. The game is launched via a bundled Java executable. As the game process is not an app bundle itself, there is no bundle identifier, so I tried to make the rule using the file path of the Java executable:

{
    "description": "Remap 1 to a",
    "manipulators": [
        {
            "conditions": [
                {
                    "file_paths": ["^/Users/foo/Library/Application Support/Steam/SteamApps/common/bar/java_vm/bin/java$"],
                    "type": "frontmost_application_if"
                }
            ],
            "from": {
                "key_code": "1",
                "modifiers": { "optional": ["any"] }
            },
            "to": [{ "key_code": "a" }],
            "type": "basic"
        },

}

The built-in System Events.app sees the Java executable as the frontmost application, using osascript -e 'tell application "System Events" to get name of first application process whose frontmost is true', but Karabiner and EventViewer do not. This happens in both windowed mode and macOS native full screen mode.

#1783 shows that Karabiner was capable of doing this at some point, so this appears to be either a bug or regression in how Karabiner and EventViewer detects frontmost applications. Can this be fixed so that Karabiner can do the switching by itself rather than rely on third-party tools to run janky scripts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions