pqrs-org / Karabiner-Elements

Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.
https://pqrs.org/osx/karabiner/
The Unlicense
18.29k stars 830 forks source link

[Feature request] Detect when inside a text field #3578

Open eugenesvk opened 11 months ago

eugenesvk commented 11 months ago

(duplicate of https://github.com/pqrs-org/Karabiner-Elements/issues/1549 https://github.com/pqrs-org/Karabiner-Elements/issues/2126 that were closed by an evil stale bot)

Would it be possible to add a detection mechanisms for text fields? For example, I want ⌘+← or ⌘+→ to go to a previous/next tab in my file/web browser, however, when I'm in a text field (e.g. typing in a search bar or renaming a file) I'd like these combinations to go to the beginning/end of a text string. So, I'd need to pass two different key combinations depending on whether I'm editing a text field or not. Thank you!

zoubenjia commented 5 months ago

+1

lowjoel commented 4 months ago

Also #651 too.

blyzer commented 3 months ago

hi, you can use complex modification rules that use command+up arrow for home and command+down arrow for end.

Home to Command up arrow

{
    "description": "Home to Command up arrow",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com\\.microsoft\\.rdc$",
                        "^com\\.microsoft\\.rdc\\.mac$",
                        "^com\\.microsoft\\.rdc\\.macos$",
                        "^com\\.microsoft\\.rdc\\.osx\\.beta$",
                        "^net\\.sf\\.cord$",
                        "^com\\.thinomenon\\.RemoteDesktopConnection$",
                        "^com\\.itap-mobile\\.qmote$",
                        "^com\\.nulana\\.remotixmac$",
                        "^com\\.p5sys\\.jump\\.mac\\.viewer$",
                        "^com\\.p5sys\\.jump\\.mac\\.viewer\\.web$",
                        "^com\\.teamviewer\\.TeamViewer$",
                        "^com\\.vmware\\.horizon$",
                        "^com\\.2X\\.Client\\.Mac$",
                        "^com\\.vmware\\.fusion$",
                        "^com\\.vmware\\.horizon$",
                        "^com\\.vmware\\.view$",
                        "^com\\.parallels\\.desktop$",
                        "^com\\.parallels\\.vm$",
                        "^com\\.parallels\\.desktop\\.console$",
                        "^org\\.virtualbox\\.app\\.VirtualBoxVM$",
                        "^com\\.citrix\\.XenAppViewer$",
                        "^com\\.vmware\\.proxyApp\\.",
                        "^com\\.parallels\\.winapp\\.",
                        "^org\\.macports\\.X11$",
                        "^com\\.apple\\.Terminal$",
                        "^com\\.googlecode\\.iterm2$",
                        "^co\\.zeit\\.hyperterm$",
                        "^co\\.zeit\\.hyper$",
                        "^io\\.alacritty$",
                        "^net\\.kovidgoyal\\.kitty$"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": {
                "key_code": "home"
            },
            "to": [
                {
                    "key_code": "up_arrow",
                    "modifiers": "command"
                }
            ],
            "type": "basic"
        }
    ]
}

End to Command down arrow

{
    "description": "End to Command down arrow",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com\\.microsoft\\.rdc$",
                        "^com\\.microsoft\\.rdc\\.mac$",
                        "^com\\.microsoft\\.rdc\\.macos$",
                        "^com\\.microsoft\\.rdc\\.osx\\.beta$",
                        "^net\\.sf\\.cord$",
                        "^com\\.thinomenon\\.RemoteDesktopConnection$",
                        "^com\\.itap-mobile\\.qmote$",
                        "^com\\.nulana\\.remotixmac$",
                        "^com\\.p5sys\\.jump\\.mac\\.viewer$",
                        "^com\\.p5sys\\.jump\\.mac\\.viewer\\.web$",
                        "^com\\.teamviewer\\.TeamViewer$",
                        "^com\\.vmware\\.horizon$",
                        "^com\\.2X\\.Client\\.Mac$",
                        "^com\\.vmware\\.fusion$",
                        "^com\\.vmware\\.horizon$",
                        "^com\\.vmware\\.view$",
                        "^com\\.parallels\\.desktop$",
                        "^com\\.parallels\\.vm$",
                        "^com\\.parallels\\.desktop\\.console$",
                        "^org\\.virtualbox\\.app\\.VirtualBoxVM$",
                        "^com\\.citrix\\.XenAppViewer$",
                        "^com\\.vmware\\.proxyApp\\.",
                        "^com\\.parallels\\.winapp\\.",
                        "^org\\.macports\\.X11$",
                        "^com\\.apple\\.Terminal$",
                        "^com\\.googlecode\\.iterm2$",
                        "^co\\.zeit\\.hyperterm$",
                        "^co\\.zeit\\.hyper$",
                        "^io\\.alacritty$",
                        "^net\\.kovidgoyal\\.kitty$"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": {
                "key_code": "end"
            },
            "to": [
                {
                    "key_code": "down_arrow",
                    "modifiers": "command"
                }
            ],
            "type": "basic"
        }
    ]
}

and this would work like the beginning and end of a page, respectively.