Skip to content

Instantly share code, notes, and snippets.

@cdesch
Forked from jamietre/pc-rules.erb
Last active July 17, 2024 16:24
Show Gist options
  • Save cdesch/5bac860cd09692c9acdcd65c9162b1e5 to your computer and use it in GitHub Desktop.
Save cdesch/5bac860cd09692c9acdcd65c9162b1e5 to your computer and use it in GitHub Desktop.
Karabiner Elements config to map home/end keys to PC-like behavior on MacOS X
{
"title": "MacOS -> PC Shortcuts",
"rules": [
{
"description": "Top/bottom of document (ctrl+home/ctrl+end)",
"manipulators": [
{
"type": "basic",
"from": <%= from("home", ["command"], ["any"]) %>,
"to": <%= to([["up_arrow", ["left_command"]]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
},
{
"type": "basic",
"from": <%= from("end", ["command"], ["any"]) %>,
"to": <%= to([["down_arrow", ["left_command"]]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
}
]
},
{
"description": "Home/end keys to the beginning/end line",
"manipulators": [
{
"type": "basic",
"from": <%= from("home", [], ["any"]) %>,
"to": <%= to([["a", ["left_control"]]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
},
{
"type": "basic",
"from": <%= from("end", [], ["any"]) %>,
"to": <%= to([["e", ["right_control"]]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
}
]
},
{
"description": "Swap Control <-> Command unless in virtual machine/remote desktop",
"manipulators": [
{
"type": "basic",
"from": <%= from("left_control", [], ["any"]) %>,
"to": <%= to([["left_command"]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
},
{
"type": "basic",
"from": <%= from("left_command", [], ["any"]) %>,
"to": <%= to([["left_control"]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
},
{
"type": "basic",
"from": <%= from("right_control", [], ["any"]) %>,
"to": <%= to([["right_command"]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
},
{
"type": "basic",
"from": <%= from("right_command", [], ["any"]) %>,
"to": <%= to([["right_control"]]) %>,
"conditions": [ <%= frontmost_application_unless(["remote_desktop", "virtual_machine"]) %> ]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment