Skip to main content

Toggling between input sources with Caps Lock in macOS

· One min read

I have recently started switching between my Arch Linux PC and MacBook for daily development. I am striving to have as similar user experience between the two machines as possible.

One of the differences that was nagging me for a while was switching between the keyboard input sources. On Arch, I have it mapped to the Caps Lock.

setxkbmap -layout us,lt -option grp:caps_toggle

However the macOS default keyboard shortcuts screen does not allow to assign the Caps Lock to toggle the next input source.

I have used a Karabiner complex modification script to map the Caps Lock to Control + Space, which is the default macOS shortcut to toggle the next input source.

{
"title": "Map caps lock to ctrl+space",
"rules": [
{
"description": "Map caps lock to ctrl+space",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "spacebar",
"modifiers": "left_control"
}
]
}
]
}
]
}

Works like a charm!