How to Use the Keyboard on a Mac Like on Windows
This document aims to help users adapt their Mac keyboard habits to be more like Windows by using Karabiner-Elements.
Basic Settings
1. Install Karabiner-Elements
First, you need to download and install Karabiner-Elements from the official website: https://karabiner-elements.pqrs.org/.
2. Simple Modifications
With the “Simple Modifications” feature in Karabiner-Elements, you can easily map keys. For example, you can set the following mappings:
left_commandtoleft_optionleft_controltoleft_commandleft_optiontoleft_control
This helps to make the Mac keyboard behavior more consistent with Windows habits.
Advanced Custom Rules (Complex Modifications)
Beyond simple modifications, Karabiner-Elements also supports “Complex Modifications”. In the Karabiner-Elements application, navigate to the “Complex Modifications” tab and click Add your own rule to add custom rules.
Below are some common custom rule JSON codes that you can paste into the new rule editor.
1. Use the Left Shift Key to Switch Input Methods
This rule allows you to switch input methods with a short press of the left Shift key, while a long press retains its original function.
*Source: https://idawnlight.com/2022/use-left-shift-to-switch-input-sources-on-macos/
{
"description": "Use left_shift to switch input sources",
"manipulators": [
{
"conditions": [
{
"bundle_identifiers": [
"^com\.teamviewer\.TeamViewer$",
"^com\.vmware\.horizon$",
"^com\.vmware\.fusion$",
"^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\."
],
"type": "frontmost_application_unless"
}
],
"from": {
"key_code": "left_shift",
"modifiers": { "optional": ["caps_lock"] }
},
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 200,
"basic.to_if_held_down_threshold_milliseconds": 200
},
"to": [
{
"key_code": "left_shift",
"lazy": true
}
],
"to_if_alone": [
{
"key_code": "spacebar",
"modifiers": "control"
}
],
"to_if_held_down": [{ "key_code": "left_shift" }],
"type": "basic"
}
]
}
2. Make the Stop Key Actually Stop Music
This rule maps the “Stop” key on the keyboard (usually in the F-key row) to execute the stop command in the “Music” application.
{
"description": "Make Stop Key actually STOP Music",
"manipulators": [
{
"from": {
"consumer_key_code": "stop",
"modifiers": { "optional": ["any"] }
},
"to": [{ "shell_command": "/usr/bin/osascript -e 'tell application \"Music\" to stop'" }],
"type": "basic"
}
]
}
3. Map the Calculator Key to Open the Calculator App
This rule maps the calculator shortcut key on the keyboard (if available) to open the built-in calculator application on macOS.
{
"description": "Map Fn+F8 (Calculator Key) to Open Calculator App",
"manipulators": [
{
"from": { "consumer_key_code": "al_calculator" },
"to": [{ "shell_command": "open -a 'Calculator.app'" }],
"type": "basic"
}
]
}
Content licensed under CC BY-NC-SA 4.0.