Skip to content

Instantly share code, notes, and snippets.

@jimpsson
Created February 25, 2018 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jimpsson/c1256a6d42049d53d5d7390af2bc24bf to your computer and use it in GitHub Desktop.
Save jimpsson/c1256a6d42049d53d5d7390af2bc24bf to your computer and use it in GitHub Desktop.
Redefine builtin MacOS default keyboard shortcuts with Karabiner-Elements to vk_none effectively making the keybinding disabled. In Karabiner-Elements vk_none means VirtualKeyboard None, use it when you want to disable any keybinding. This example disables Application Switcher (command+tab), and/or Application Quit keyboard shortcut (command+q).
{
"title": "Disable MacOS builtin default keybindings (@jimpsson)",
"rules": [
{
"description": "Disable Application Switcher (command+tab)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "tab",
"modifiers": {
"mandatory": ["command"]
}
},
"to": [
{
"key_code": "vk_none"
}
]
}
]
},
{
"description": "Disable command+q (great when you only use it on accident time to time)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "q",
"modifiers": {
"optional": ["any"],
"mandatory": ["command"]
}
},
"to": [
{
"key_code": "vk_none"
}
]
}
]
}
]
}

DISABLE CMD+TAB AND/OR CMD+Q

Redefine your builtin MacOS default keyboard shortcuts using Karabiner-Elements. Binding two specific keybindings to vk_none resulting in effectively disabling the named keybinding.

In Karabiner-Elements the vk_none keycode means virtualkeyboard none. Use it when you want to disable any existing keybinding, or perhaps as some boilerplate for your not yet implemented keybindings.

This demo shows you how to disable the application switcher (command+tab), and/or application quit (command+q) keybinding. Nothing fancy about this config at all, but I have some ideas on how to improve this.

I will update this gist as I update my local configuration.

@samlandfried
Copy link

You're a king, Jimmy! Disabling cmd + tab will be a boon for my productivity.

Just to clarify, I didn't want to disable cmd + q, I wanted cmd + tab to replace cmd + q, so if I tried to cmd + tab it would close the current application. My thinking was that would train me off of cmd + tab quickly.

This is great though and is exactly what I needed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment