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.91k stars 839 forks source link

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

Open eugenesvk opened 1 year ago

eugenesvk commented 1 year 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 10 months ago

+1

lowjoel commented 8 months ago

Also #651 too.

blyzer commented 7 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.

jiabaoyu commented 3 months ago

Bump this up!

VanSantCode commented 2 weeks ago

I wrote an AutoHotKey script that finds the current location of the typing caret compared to the expected x,y coordinate location of the Google Chrome address-bar/omnibox.

Otherwise, especially on MacOS, I too am stumped on being able to setup a boolean value defining whether or not any text field, in Google Chrome or not, is currently focussed; being able to perform the text field focus boolean check would greatly benefit my keyboard movement.