Related
I'd like to make a complex modification that makes macOS to go to sleep when I holding the F6/☾ key.
The following config is working BUT when I release the key that wakes up the OS instantly.
Maybe it can be combine with to_after_key_up but can't find it how to do it.
{
"description": "Map F6 (Do Not Disturb) to Cmd+Opt+Eject for Sleep Mac",
"manipulators": [{
"from": {
"key_code": "f6"
},
"type": "basic",
"parameters": {
"basic.to_if_alone_timeout_milliseconds": 250,
"basic.to_if_held_down_threshold_milliseconds": 1000
},
"to_if_alone": [
{
"key_code": "f6"
}
],
"to_if_held_down": [
{
"repeat": false,
"consumer_key_code": "eject",
"modifiers": ["left_gui", "left_alt"]
}
]
}]
}
Can't find a solution to the key releasing issue so as a workaround I'm created one with double press the F6/☾ key for same functionality:
{
"description": "Map 2x F6 (Do Not Disturb) to Cmd+Opt+Eject for Sleep Mac",
"manipulators": [
{
"type": "basic",
"conditions": [
{
"type": "variable_if",
"name": "sleep",
"value": 1
}
],
"from": {
"key_code": "f6"
},
"to_after_key_up": [{
"repeat": false,
"consumer_key_code": "eject",
"modifiers": ["left_gui", "left_alt"]
}]
},
{
"type": "basic",
"from": {
"key_code": "f6"
},
"to": [
{
"set_variable": {
"name": "sleep",
"value": 1
}
}
],
"to_delayed_action": {
"to_if_invoked": [
{
"set_variable": {
"name": "sleep",
"value": 0
}
},
{
"key_code": "f6"
}
],
"to_if_canceled": [
{
"set_variable": {
"name": "sleep",
"value": 0
}
}
]
},
"parameters": {
"basic.to_delayed_action_delay_milliseconds": 200
}
}
]
}
The reason I wanted to differentiate against single F6 press is that I'm using it in file explorers to move files between panels.
I'm trying to map å (option-a) to ä (option-u, a) and Å (option-shift-a) to Ä (option-u, shift-a). I was able to figure out the first one:
{
"description": "German: å to ä",
"manipulators": [
{
"from": {
"key_code": "a",
"modifiers": {
"mandatory": [
"option"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "u",
"modifiers": ["left_option"]
},
{
"key_code": "a"
}
],
"type": "basic"
},
]
}
but I'm having trouble figuring out the second one. If I hold down shift, I end up with ¨A, not Ä.
Use Karabiner-EventViewer or Apple's Keyboard Viewer while doing it manually to see shift-option-u gets a bare ¨, option-u a gets ä and option-u shift-a gets Ä so was:
{"title": "German: å to ä",
"rules": [{"description": "⌥a to ä and ⇧⌥A to Ä.",
"manipulators": [
{"from": {"key_code": "a", "modifiers": {"mandatory": ["option"],
"optional": ["caps_lock", "control", "command"]}},
"to": [{"key_code": "u", "modifiers": ["option"]},
{"key_code": "a"}],
"type": "basic"},
{"from": {"key_code": "a", "modifiers": {"mandatory": ["option", "shift"],
"optional": ["caps_lock", "control", "command"]}},
"to": [{"key_code": "u", "modifiers": ["option"]},
{"key_code": "a", "modifiers": ["shift"]}],
"type": "basic"}]}]}
The title says it all. One more information is that I use apple wired keyboard with macbook pro - "clam shell is closed" while external monitors are attached. I added the following at the correct file, but doesn't work. I want to use it for Xcode and Visual Studio Code, etc.
{
"description": "Move Up / Down 10",
"manipulators": [
{
"from": {
"key_code": "up_arrow"
},
"to": [
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
}
]
}
]
}
Two things, first you forgot to add "type": "basic"
Second: you must add "modifiers": {"mandatory": ["left_option"]}
{
"description": "Move Up / Down 10",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "up_arrow",
"modifiers": {"mandatory": ["left_option"]}
},
"to": [
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
}
]
}
]
}
In addition, if you want to make 'shift + option + up/down' jump 10 lines WITH SELECTION, use this. This also contains another useful modifications for 'cmd + up/down/left/right' to page up/down, home, end with selections:
{
"description": "LCMD + Up to Page Up",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "up_arrow",
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"to": [
{
"key_code": "page_up"
}
]
},
{
"type": "basic",
"from": {
"key_code": "up_arrow",
"modifiers": {
"mandatory": [
"left_command",
"left_shift"
]
}
},
"to": [
{
"key_code": "page_up",
"modifiers": [
"left_shift"
]
}
]
}
]
},
{
"description": "LCMD + Down to Page Down",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "down_arrow",
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"to": [
{
"key_code": "page_down"
}
]
},
{
"type": "basic",
"from": {
"key_code": "down_arrow",
"modifiers": {
"mandatory": [
"left_command",
"left_shift"
]
}
},
"to": [
{
"key_code": "page_down",
"modifiers": [
"left_shift"
]
}
]
}
]
},
{
"description": "LCMD + Left to Home",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_arrow",
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"to": [
{
"key_code": "home"
}
]
},
{
"type": "basic",
"from": {
"key_code": "left_arrow",
"modifiers": {
"mandatory": [
"left_command",
"left_shift"
]
}
},
"to": [
{
"key_code": "home",
"modifiers": [
"left_shift"
]
}
]
}
]
},
{
"description": "LCMD + Right to End",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "right_arrow",
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"to": [
{
"key_code": "end"
}
]
},
{
"type": "basic",
"from": {
"key_code": "right_arrow",
"modifiers": {
"mandatory": [
"left_command",
"left_shift"
]
}
},
"to": [
{
"key_code": "end",
"modifiers": [
"left_shift"
]
}
]
}
]
},
{
"description": "Move Up / Down 10",
"manipulators": [
{
"from": {
"key_code": "up_arrow",
"modifiers": {
"mandatory": [
"left_option"
]
}
},
"to": [
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
},
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "up_arrow",
"modifiers": {
"mandatory": [
"left_option",
"left_shift"
]
}
},
"to": [
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "up_arrow",
"modifiers": [
"left_shift"
]
}
],
"type": "basic"
},
{
"from": {
"key_code": "down_arrow",
"modifiers": {
"mandatory": [
"left_option"
]
}
},
"to": [
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
},
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"from": {
"key_code": "down_arrow",
"modifiers": {
"mandatory": [
"left_option",
"left_shift"
]
}
},
"to": [
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
},
{
"key_code": "down_arrow",
"modifiers": [
"left_shift"
]
}
],
"type": "basic"
}
]
}
Love this program and thankful for any help
Like the title states, I have my left hand on my SHIFT KEY, OPTION KEY and COMMAND key all the time. but I hate when I have to use my arrow keys to move shapes. I would like the ability to change WASD as arrow keys to nudge shapes around. This also allows for the pinky to hit the left SHIFT KEY so that I could move shape 10px at a time. However, I want to be able to toggle to the arrow function by pressing Caps lock and holding it until I release. Doing this will enable me to make more use of hotkeys while building/UI.
To summarize:
Program active
keyboard is in default state when Caps lock is off
While Caps lock is on I am able to use WASD as arrow keys
Once I hit Caps lock, keys will return to default state.
Thank you so much for whatever help you guys can throw my way. Hope this has already been addressed and is easy fix
This works for me:
{
"description": "WASD arrow Keys toggled by Capslock",
"manipulators": [
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_unless",
"value": 1
}
],
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "wasd_arrow_keys_mode",
"value": 1
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "wasd_arrow_keys_mode",
"value": 0
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "a",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "s",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "w",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "d",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
}
]
}
You can either place the code inside the brackets of the "rules": [] element of the file ~/.config/karabiner/karabiner.json, or create a new JSON file in ~/.config/karabiner/assets/complex_modifications, wrapping the code above in:
{
"title": "WASD arrow Keys toggled by Capslock",
"rules": [
(insert code here)
]
}
If you opt for the separate JSON file, once saved you can enable it through the Karabiner-Elements UI via Complex Modifications > Add rule.
I‘m using Karabiner beta 12.1.56 but it should work on Karabiner stable.
Note that this script replaces the functionality of caps lock, meaning: it works as an arrow key toggler, not as an uppercase key toggler.
This is a modification of the script "TouchCursor Mode" from the Karabiner site, which toggles a variable when pressing capslock, then uses WASD as keys or arrows depending on that variable. Similar technique to the one used by #user9680958.
Both solutions for caps lock mode and caps hold mode:
p.s. you can easily switch the script down below to "wasd" or "hjkl", etc.
1. Setup Karabiner:
Download Karabiner
When opening it requires to enable some stuff in the Settings (just follow the steps it requests from you)
Set up the Script:
Create a JSON file on your desktop:
cmd + space to open the spotlight
type in terminal
type in cd
type in cd desktop
touch myscript.json
copy paste one of the codes down below in the new file
Go back to the terminal
Type in cd
Type cd desktop
Type mv myscript.json ~/.config/karabiner/assets/complex_modifications
Now open Karabiner Elements and go to "Complex modifications"
Press "add Rule"
Now there should be your custom rule to enable
Have fun.
Code 1 for Caps lock "to enter arrow key mode" and press again "to exit arrow key mode":
{
"title": "ijkl arrow Keys toggled by Capslock",
"rules": [
{
"description": "ijkl arrow Keys toggled by Capslock",
"manipulators": [
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_unless",
"value": 1
}
],
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "wasd_arrow_keys_mode",
"value": 1
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "wasd_arrow_keys_mode",
"value": 0
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "j",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "k",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "i",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "l",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
}
]
}
]
}
Code 2 If you want to hold Caps while using the arrow Keys use this one instead:
{
"title": "ijkl arrow Keys toggled by Capslock",
"rules": [
{
"description": "ijkl arrow Keys toggled by Capslock",
"manipulators": [
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_unless",
"value": 1
}
],
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "wasd_arrow_keys_mode",
"value": 1
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"set_variable": {
"name": "wasd_arrow_keys_mode",
"value": 0
}
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "j",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "k",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "i",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "wasd_arrow_keys_mode",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "l",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
}
]
}
]
}
{
"type": "basic",
"description": "",
"from": {
"key_code": "w",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"description": "",
"from": {
"key_code": "s",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"description": "",
"from": {
"key_code": "a",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "left_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"description": "",
"from": {
"key_code": "d",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "caps_lock"
},
{
"set_variable": {
"name": "caps_lock pressed",
"value": 0
}
}
],
"conditions": [
{
"type": "variable_if",
"name": "caps_lock pressed",
"value": 1
}
]
},
{
"type": "basic",
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "caps_lock"
}
],
"to_if_alone": [
{
"set_variable": {
"name": "caps_lock pressed",
"value": 1
}
}
]
}
I'm new to Karabiner on Mac and I'm trying to map left_option + e to deleting a line.
I know this involves defining the following keystrokes for left_command + e: left_command + shift + left_arrow + backspace_or_delete, but I don't know how to input it to the json file
Here I created code that moves cursor to the beginning of the line and then deletes it.
{
"description": "Delete line",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "e",
"modifiers": {
"mandatory": ["left_option"]
}
},
"to": [
{
"key_code": "a",
"modifiers": ["left_control"]
},
{
"key_code": "k",
"modifiers": ["left_control"]
}
]
}
]
}