Skip to content

Instantly share code, notes, and snippets.

@nicola-strappazzon
Last active March 28, 2021 09:40
Show Gist options
  • Save nicola-strappazzon/f00d0b4a74358a63607dd3eeb27a6519 to your computer and use it in GitHub Desktop.
Save nicola-strappazzon/f00d0b4a74358a63607dd3eeb27a6519 to your computer and use it in GitHub Desktop.
Custom mapping in MAX OS X

Custom keyboard mapping

  • Re-Map Grave key to Esc for fucking touch bar in the Macbook Pro.
  • Change second display brightness and contrast with fn + 3 to 7.
  • Launcher applications: Activity Monitor, Firefox, iTerm and Spotify.
  • Select area to take screenshot.
  • Lock session.
  • Paste without format.

Requirements

Instructions

First, do you need download and install Karabiner-Elements and then modify custom config, edit the follow file with the .json example

vim .config/karabiner/karabiner.json

For more example, please visit here.

{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 1000,
"basic.to_if_held_down_threshold_milliseconds": 500,
"mouse_motion_to_scroll.speed": 100
},
"rules": [
{
"description": "Escape",
"manipulators": [
{
"type": "basic",
"from":
{ "key_code": "grave_accent_and_tilde" },
"to":
[ { "key_code": "escape" } ]
}
]
},
{
"description": "[fn + 3-7] Second Display brightness and contrast",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "3",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/ddcctl -d 1 -w 10 -b 30 -c 40"
}
]
},
{
"type": "basic",
"from": {
"key_code": "4",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/ddcctl -d 1 -w 10 -b 40 -c 50"
}
]
},
{
"type": "basic",
"from": {
"key_code": "5",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/ddcctl -d 1 -w 10 -b 50 -c 60"
}
]
},
{
"type": "basic",
"from": {
"key_code": "6",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/ddcctl -d 1 -w 10 -b 60 -c 70"
}
]
},
{
"type": "basic",
"from": {
"key_code": "7",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "/usr/local/bin/ddcctl -d 1 -w 10 -b 70 -c 80"
}
]
}
]
},
{
"description": "[fn + a] App launcher: Activity Monitor",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "open -a '/System/Applications/Utilities/Activity Monitor.app'"
}
]
}
]
},
{
"description": "[fn + f] App launcher: Firefox",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "f",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "open -a '/Applications/Firefox.app'"
}
]
}
]
},
{
"description": "[fn + t] App launcher: iTerm2",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "t",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "open -a '/Applications/iTerm.app'"
}
]
}
]
},
{
"description": "[fn + s] App launcher: Spotify",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "s",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": [
{
"shell_command": "open -a '/Applications/Spotify.app'"
}
]
}
]
},
{
"description": "[fn + c] Select area to take screenshot",
"manipulators": [
{
"from": {
"key_code": "c",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": {
"key_code": "4",
"modifiers": [
"left_command",
"left_shift"
]
},
"type": "basic"
}
]
},
{
"description": "[fn + l] Lock session",
"manipulators": [
{
"from": {
"key_code": "l",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": {
"key_code": "q",
"modifiers": [
"left_command",
"left_control"
]
},
"type": "basic"
}
]
},
{
"description": "[fn + v] Paste without format",
"manipulators": [
{
"from": {
"key_code": "v",
"modifiers": {
"mandatory": [
"fn"
]
}
},
"to": {
"key_code": "v",
"modifiers": [
"left_command",
"left_shift",
"left_option"
]
},
"type": "basic"
}
]
},
{
"description": "Mouse button4 → command + ]",
"manipulators": [
{
"from": {
"pointing_button": "button4"
},
"to": {
"key_code": "close_bracket",
"modifiers": [
"left_command"
]
},
"type": "basic"
}
]
},
{
"description": "Mouse button5 → command + [",
"manipulators": [
{
"from": {
"pointing_button": "button5"
},
"to": {
"key_code": "open_bracket",
"modifiers": [
"left_command"
]
},
"type": "basic"
}
]
}
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment