The behavior of the Home/End buttons from an external keyboard is not moving to the cursor to the beginning/end of line. Karabiner-EventView is reporting the Home key as Fn+Home and the End key as Fn+End. How can I improve my rule so that it will work?
{
"title": "Home / End on External Keyboard",
"rules": [
{
"description": "Change Home to Command + Left Arrow",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "home",
"modifiers": {
"mandatory": ["fn"]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["right_command"]
}
]
}
]
},
{
"description": "Change End to Command + Right Arrow",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "end",
"modifiers": {
"mandatory": ["fn"]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["right_command"]
}
]
}
]
}
]
}
Home/End can move to the cursor to the beginning/end of line by changing "mandatory" to "optional. However, I ran new into a new issue, where Shift + Home & Shift + End were not behaving as expected. I came up with this fix, but it seems messy. Can anyone improve on it?
{
"title": "Home / End on External Keyboard",
"rules": [
{
"description": "Change Home to [Command + Left Arrow]",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "home",
"modifiers": {
"optional": ["fn"]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["right_command"]
}
]
}
]
},
{
"description": "Change End to [Command + Right Arrow]",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "end",
"modifiers": {
"optional": ["fn"]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["right_command"]
}
]
}
]
},
{
"description": "Change [Shift + Home] to [Shift + Command + Left Arrow]",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "home",
"modifiers": {
"optional": ["fn"],
"mandatory": ["left_shift"]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": ["right_shift", "right_command"]
}
]
}
]
},
{
"description": "Change [Shift + Home] to [Shift + Command + Left Arrow]",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "end",
"modifiers": {
"optional": ["fn"],
"mandatory": ["left_shift"]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": ["right_shift", "right_command"]
}
]
}
]
}
]
}
I came along with this, I don't know if it is less messy to you - but it works for me so far:
{
"title": "PC Style",
"rules": [
{
"description": "Home / End (except VS Code, iTerm, Terminal and vim)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "home"
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_command"
]
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.vim\\.",
"^com.googlecode.iterm2",
"^com.microsoft.VSCode",
"^com.apple.Terminal"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "home",
"modifiers": {
"mandatory": [
"left_shift"
]
}
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_command",
"left_shift"
]
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.vim\\.",
"^com.googlecode.iterm2",
"^com.microsoft.VSCode",
"^com.apple.Terminal"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "end"
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_command"
]
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.vim\\.",
"^com.googlecode.iterm2",
"^com.microsoft.VSCode",
"^com.apple.Terminal"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "end",
"modifiers": {
"mandatory": [
"left_shift"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_command",
"left_shift"
]
}
],
"conditions": [
{
"type": "frontmost_application_unless",
"bundle_identifiers": [
"^org\\.vim\\.",
"^com.googlecode.iterm2",
"^com.microsoft.VSCode",
"^com.apple.Terminal"
]
}
]
}
]
},
{
"description": "Home / End (Terminal)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "home"
},
"to": [
{
"key_code": "left_arrow",
"modifiers": [
"left_shift",
"fn"
]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com.apple.Terminal"
]
}
]
},
{
"type": "basic",
"from": {
"key_code": "end"
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_shift",
"fn"
]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"^com.apple.Terminal"
]
}
]
}
]
}
]
}
You added some things I didn't think of. Thank you.
On Fri, Sep 15, 2017 at 7:32 AM Tobias Punke notifications@github.com
wrote:
I came along with this, I don't know if it is less messy to you - but it
works for me so far:`{
"title": "PC Style",
"rules": [
{
"description": "Home / End (except VS Code, iTerm, Terminal and vim)",
"manipulators": [{ "type": "basic", "from": { "key_code": "home" }, "to": [ { "key_code": "left_arrow", "modifiers": [ "left_command" ] } ], "conditions": [ { "type": "frontmost_application_unless", "bundle_identifiers": [ "^org\\.vim\\.", "^com.googlecode.iterm2", "^com.microsoft.VSCode", "^com.apple.Terminal" ] } ] }, { "type": "basic", "from": { "key_code": "home", "modifiers": { "mandatory": [ "left_shift" ] } }, "to": [ { "key_code": "left_arrow", "modifiers": [ "left_command", "left_shift" ] } ], "conditions": [ { "type": "frontmost_application_unless", "bundle_identifiers": [ "^org\\.vim\\.", "^com.googlecode.iterm2", "^com.microsoft.VSCode", "^com.apple.Terminal" ] } ] }, { "type": "basic", "from": { "key_code": "end" }, "to": [ { "key_code": "right_arrow", "modifiers": [ "left_command" ] } ], "conditions": [ { "type": "frontmost_application_unless", "bundle_identifiers": [ "^org\\.vim\\.", "^com.googlecode.iterm2", "^com.microsoft.VSCode", "^com.apple.Terminal" ] } ] }, { "type": "basic", "from": { "key_code": "end", "modifiers": { "mandatory": [ "left_shift" ] } }, "to": [ { "key_code": "right_arrow", "modifiers": [ "left_command", "left_shift" ] } ], "conditions": [ { "type": "frontmost_application_unless", "bundle_identifiers": [ "^org\\.vim\\.", "^com.googlecode.iterm2", "^com.microsoft.VSCode", "^com.apple.Terminal" ] } ] }]
},{
"description": "Home / End (Terminal)",
"manipulators": [{ "type": "basic", "from": { "key_code": "home" }, "to": [ { "key_code": "left_arrow", "modifiers": [ "left_shift", "fn" ] } ], "conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com.apple.Terminal" ] } ] }, { "type": "basic", "from": { "key_code": "end" }, "to": [ { "key_code": "right_arrow", "modifiers": [ "left_shift", "fn" ] } ], "conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com.apple.Terminal" ] } ] }]
}]
}
`—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/tekezo/Karabiner-Elements/issues/970#issuecomment-329756606,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJ8qV_Ol7AyO6b-1VH4KJu90RcObSr-Nks5simA5gaJpZM4POfRl
.
Gaulomatic, you're a hero. Much better than the Cmd-A and Cmd-E which comes as a standard.
Most helpful comment
I came along with this, I don't know if it is less messy to you - but it works for me so far: