Skip to content

Instantly share code, notes, and snippets.

@gh640
Last active February 23, 2023 01:19
Show Gist options
  • Save gh640/034311ca10248d0f82db8aed12d3573b to your computer and use it in GitHub Desktop.
Save gh640/034311ca10248d0f82db8aed12d3573b to your computer and use it in GitHub Desktop.
Karabiner-Elements configuration to change numbers with both shift keys if pressed with both shift keys
{
"title": "Both shifts + numbers => Keypad numbers",
"rules": [
{
"description": "Both shifts + 1 => Keypad 1",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "1",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_1"
}
]
}
]
},
{
"description": "Both shifts + 2 => Keypad 2",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "2",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_2"
}
]
}
]
},
{
"description": "Both shifts + 3 => Keypad 3",
"manipulators": [
{
"type": "basic",
"from": {
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
},
"key_code": "3"
},
"to": [
{
"repeat": true,
"key_code": "keypad_3"
}
]
}
]
},
{
"description": "Both shifts + 4 => Keypad 4",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "4",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_4"
}
]
}
]
},
{
"description": "Both shifts + 5 => Keypad 5",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "5",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_5"
}
]
}
]
},
{
"description": "Both shifts + 6 => Keypad 6",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "6",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_6"
}
]
}
]
},
{
"description": "Both shifts + 7 => Keypad 7",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "7",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_7"
}
]
}
]
},
{
"description": "Both shifts + 8 => Keypad 8",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "8",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_8"
}
]
}
]
},
{
"description": "Both shifts + 9 => Keypad 9",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "9",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_9"
}
]
}
]
},
{
"description": "Both shifts + 0 => Keypad 0",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "0",
"modifiers": {
"mandatory": [
"left_shift",
"right_shift"
]
}
},
"to": [
{
"repeat": true,
"key_code": "keypad_0"
}
]
}
]
}
]
}
@gh640
Copy link
Author

gh640 commented Feb 13, 2023

@gh640
Copy link
Author

gh640 commented Feb 13, 2023

Environment

❯ sw_vers
ProductName:		macOS
ProductVersion:		13.2
BuildVersion:		22D49
  • Karabiner-Elements 14.11.0

The keyboard layout is expected to be ANSI.

@gh640
Copy link
Author

gh640 commented Feb 13, 2023

Usage

Put this file both-shifts-keypad.json into ~/.config/karabiner/assets/complex_modifications.

Approach A) Import the setting via a link

url='https://gist.githubusercontent.com/gh640/034311ca10248d0f82db8aed12d3573b/raw/a08030db5cf47a5626be1ba63e79fdfb23956fd2/both-shifts-keypad.json'
open "karabiner://karabiner/assets/complex_modifications/import?url=${url}"

Approach B) Download and put the file manually

url='https://gist.githubusercontent.com/gh640/034311ca10248d0f82db8aed12d3573b/raw/a08030db5cf47a5626be1ba63e79fdfb23956fd2/both-shifts-keypad.json'
cd ~/.config/karabiner/assets/complex_modifications
http -d "${url}"

Open Karabiner-Elements Settings window and go to Complex Modifications:

Screenshot by Dropbox Capture

Click Add rule:

Screenshot by Dropbox Capture

Enable the rules:

Screenshot by Dropbox Capture

@gh640
Copy link
Author

gh640 commented Feb 23, 2023

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