Karabiner

User avatar
Muirium
µ

23 Mar 2021, 12:52

Dr. Strangemod
Or: How I Learned To Stop Worrying And Love Karabiner

So, back in November, I hurried on down to Apple Princes Street and picked up an M1 MacBook Air on launch day. (16 gigs / 1 TB / space grey, obviously.) Nifty wee machine. Blew my 2013 MacBook Pro out the water, naturally, all while both eerily quiet and downright supernaturally cool. The legends… they're all true?

Well anyway, I got it in Apple's UK keyboard layout because I didn't want to wait—another lockdown was just days away—and I could always use their extended new year return period if the layout drove me nuts. See, I'm used to ANSI. How hard could going back to ISO be?

This is what I'm used to on my laptop:

MacBook Air US keyboard 0012_hardware-hero-pt-open-spgry_lg copy.jpg
MacBook Air US keyboard 0012_hardware-hero-pt-open-spgry_lg copy.jpg (199.63 KiB) Viewed 147171 times

Apple's UK images still show American layout. But the layout over here is Apple's ISO style. The same as above, but with their skinny-assed Return key, the ever curious § key up above Tab and tilde tucked down by small left Shift, like this:

Spoiler:
MLA22B.jpeg
MLA22B.jpeg (163.09 KiB) Viewed 147171 times
Edit: Here's my µBook Air itself, a year and a bit into duty:

µBook Air.jpg
µBook Air.jpg (260.56 KiB) Viewed 142235 times

One thing their ISO keyboards do have going for them: icon mods. I do like these! Much more stylish than having things like "delete" spelled out on the keys. (That's Backspace you dimwits!) They're a throwback to my 12" PowerBook, only higher contrast and backlit. Indeed, my distant familiarity with this layout started giving me ideas…
Spoiler:
Apple-PowerBook-G4-12-inch_4.jpg
Apple-PowerBook-G4-12-inch_4.jpg (48.59 KiB) Viewed 147171 times
Edit: Here's my PowerBook, almost 19 years old now. And more than its fair share of those in heavy use. Can you tell?

µBook G4.jpg
µBook G4.jpg (243.68 KiB) Viewed 142235 times

As far as laptops go, the Air's keyboard is obviously much better than those from the horrific "Butterfly" era. Minimal keyfeel aside—thump-thump-thump—those butterfly laptops were aptly named when it came to reliability, so I skipped them entirely. The relevant comparison for me was with my 7 year old 15" MacBook Pro. I like these new ones much more than Apple's previous scissor-switch. They're less 'floppy', they've got tighter tolerances, and while they'll win no contests with Topre and all the other real keyboards I love, they're passable for a slim laptop, and just as reliable.

But this Apple/ISO layout keeps reminding me of my 2003 PowerBook, my first Mac. The old PowerBook's keyboard is sculpted—I still prefer the key shape to all these chiclets since—and has a lot more travel. But here's the oddball: back in those days, Mac laptops had an Enter key over to the right of the spacebar. I found myself hitting right Option when completing File > Save dialogs and the like. That old muscle memory was flowing back!

Alright already Mu, what's all this got to do with Karabiner?

Let's reprogram this thing!

I'm used to programmable keyboards. Soarer's, TMK in my HHKB, QMK in my Kishy. After hitting that accursed ` key when reaching for left Shift for the hundredth goddamn time, I knew this built in keyboard was in sore need of some modding. It was time for me to make my peace with Karabiner.

Usually, I do all my key-swapping in the keyboards themselves. MacOS does have some minimal functionality—you can reorder the modifiers on individual keyboards—but nothing like as complimacated as I was looking for:

Sys Prefs > Modifier Keys.jpg
Sys Prefs > Modifier Keys.jpg (70.98 KiB) Viewed 147171 times
So, here's what I've gotten up to in Karabiner. It's complex!

Karabiner > Complex Mods.jpg
Karabiner > Complex Mods.jpg (128.31 KiB) Viewed 147171 times
Karabiner calls simple key-swaps "simple modifications". You can do quite a bit with just those. But I'm a special flower, always…

Karabiner's also got a library of ready made "complex modifications" but even these weren't sufficiently complex for µ. So I rolled up my sleeves and cooked up my own in JSON. Karabiner's rule format is… clunky, but powerful. It did allow me to do quite a lot of trickery indeed, including all my usual staples like Shift + Shift > Caps Lock, and more besides.

For anyone interested, my rules come in 3 varieties, in 3 different files. First: the General Complex Rules which apply to all keyboards, including my laptop's own:

Code: Select all

{
	"title": "General Complex Rules",
	"rules": [
	    {
	        "description": "Shift + Shift ⇨ Caps Lock",
	        "manipulators": [
	            {
	                "from": {
	                    "key_code": "left_shift",
	                    "modifiers": {
	                        "mandatory": [
	                            "right_shift"
	                        ],
	                        "optional": [
	                            "any"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "caps_lock"
	                    }
	                ],
	                "type": "basic"
	            },
	            {
	                "from": {
	                    "key_code": "right_shift",
	                    "modifiers": {
	                        "mandatory": [
	                            "left_shift"
	                        ],
	                        "optional": [
	                            "any"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "caps_lock"
	                    }
	                ],
	                "type": "basic"
	            }
	        ]
	    },
	    {
	        "description": "Shift + Backspace ⇨ Delete",
	        "manipulators": [
	            {
	            	"conditions": [
						{
							"type": "frontmost_application_if",
							"bundle_identifiers": [
								"com.apple.finder"
							]
						}
					],
	                "from": {
	                    "key_code": "delete_or_backspace",
	                    "modifiers": {
	                        "mandatory": [
	                            "shift"
	                        ],
	                        "optional": [
	                            "option"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "delete_forward"
	                    }
	                ],
	                "type": "basic"
	            },
	         	{
					"conditions": [
						{
							"type": "frontmost_application_unless",
							"bundle_identifiers": [
								"com.apple.finder"
							]
						}
					],
	                "from": {
	                    "key_code": "delete_or_backspace",
	                    "modifiers": {
	                        "mandatory": [
	                            "shift"
	                        ],
	                        "optional": [
	                            "any"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "delete_forward"
	                    }
	                ],
	                "type": "basic"
	            }

	        ]
	    },
	    {
	        "description": "Right Option alone ⇨ 🗣 Enter",
	        "manipulators": [
	        {
	            "type": "basic",
	            "from": {
	                "key_code": "right_option"
	            },
	            "to": [
					{
						"key_code": "right_option"
					}
				],
	            "to_if_alone": [
	                {
	                    "key_code": "keypad_enter"
	                }
	            ]
	        },
	    	{
				"from": {
					"key_code": "right_option",
					"modifiers": {
						"mandatory": [
							"right_command"
						]
					}
				},
				"to": [
					{
						"key_code": "s",
						"modifiers": [
							"right_command",
							"right_control"
						],
						"repeat": true
					}
				],
				"type": "basic"
			}
	        ]
	    },
		{
			"description": "Fine Volume: Command ± 🔉  ⇨ Shift + Option ± 🔉",
			"manipulators": [
				{
					"from": {
						"key_code": "f11",
						"modifiers": {
							"mandatory": ["command"]
						}
					},
					"to": [
							{
								"key_code": "volume_decrement",
								"modifiers": [
									"left_shift",
									"left_alt"
								],
								"repeat": true
							}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f12",
						"modifiers": {
							"mandatory": ["command"]
						}
					},
					"to": [
						{
							"key_code": "volume_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "Fine Brightness: Command ± 🔅  ⇨ Shift + Option ± 🔅",
			"manipulators": [
				{
					"from": {
						"key_code": "f1",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_decrement",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "Contrast: Control ± 🔅  ⇨ Control + Option + Command ± .",
			"manipulators": [
				{
					"from": {
						"key_code": "f1",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "period",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "comma",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		}
	]
}
I've given them graphic looking names, to make them easier to pick out in the GUI.

What I've done here is give the right Option (Alt) key a second purpose as a (Numpad) Enter key, which I've gotten back into using as a quickly reachable confirm key. And, on top of that, I've also given it the 🗣 screen reader combo, as I used to have it set on my PowerBook. Yes, I like my computers talking to me! Well, it's a good way to hear typos in what I write. Those two keys make a great roll combo that I've missed for a decade. Now it's back!

Shift + Shift > Caps Lock, always. And Shift + Backspace for (forward) Delete is just as natural, too. I've gotten used to both of these from my programmable keyboards.

Oh, and I've made the shortcuts for fine brightness and volume control much more natural. Contrast is a handy thing to tweak sometimes too.

Here's the Built in Keyboard specific rules, just for my laptop's own keys:

Code: Select all

{
	"title": "Built in Keyboard Rules",
	"type": "device_if",
	"rules": [
		{
	        "description": "Built in Keyboard: Caps Lock ⇨ Right Control",
	        "manipulators": [
	        {
	         	"conditions": [
          		  {
				  "type": "device_if",
				  "identifiers": [
					{
					  "vendor_id": 1452,
					  "product_id": 641
					}
				  ]
            }
          ],
	            "from": {
                	"key_code": "caps_lock",
                    "modifiers": {
                    	"optional": ["any"]
                    }
                },
                "to": [
                    {
    	                "key_code": "right_control"
                    }
                    ],
                    "type": "basic"
                }
	        ]
	    },
	    {
	    	"description": "Built in Keyboard: Transform § ⇨ Backtick (Fn to override)",
	        "manipulators": [
	    	{
	         	"conditions": [
          		  {
				  "type": "device_if",
				  "identifiers": [
					{
					  "vendor_id": 1452,
					  "product_id": 641
					}
				  ]
            }
          ],
	            "type": "basic",
	            "from": {
	                "key_code": "non_us_backslash",
	                "modifiers": {
	                	"mandatory": ["fn"],
	                	"optional": ["any"]
	                }
	            },
	            "to": [
	                {
	                    "key_code": "non_us_backslash"
	                }
	            ]
	        },
	        {
	            "type": "basic",
	            "from": {
	                "key_code": "non_us_backslash",
	                "modifiers": {
	                	"optional": ["any"]
	                }
	            },
	            "to": [
	                {
	                    "key_code": "grave_accent_and_tilde"
	                }
	            ]
	        }
	    	]
	    },
	    {
	        "description": "Built in Keyboard: Backtick ⇨ Right Shift or Backtick when alone",
	        "manipulators": [
	        {
	         	"conditions": [
          		  {
				  "type": "device_if",
				  "identifiers": [
					{
					  "vendor_id": 1452,
					  "product_id": 641
					}
				  ]
            }
          ],
	            "type": "basic",
	            "from": {
	                "key_code": "grave_accent_and_tilde",
	                "modifiers": {
	                    "optional": ["any"]
	                }
	            },
	            "to": [
	                {
	                    "key_code": "right_shift",
	                    "lazy": true
	                }
	            ],
	            "to_if_alone": [
	                {
	                    "key_code": "grave_accent_and_tilde"
	                }
	            ]
	        }
	        ]
	    },
	    {
            "description": "Built in Keyboard: ❌ Backslash ⇨ Return or Backslash with Right Option",
            "manipulators": [
                {
	         	"conditions": [
          		  {
				  "type": "device_if",
				  "identifiers": [
					{
					  "vendor_id": 1452,
					  "product_id": 641
					}
				  ]
            }
          ],
                    "from": {
                        "key_code": "backslash",
                        "modifiers": {
                            "mandatory": [
                                "right_option"
                            ],
                            "optional": [
                                 "any"
                            ]
                        }
                    },
                    "to": [
                        {
                            "key_code": "backslash"
                        }
                    ],
                    "type": "basic"
                },
                {
                    "from": {
                        "key_code": "backslash",
                        "modifiers": {
                            "optional": [
                                 "any"
                            ]
                        }
                    },
                    "to": [
                        {
                            "key_code": "return_or_enter"
                        }
                    ],
                    "type": "basic"
                }
            ]
        }
	]
}
These are the fiddly special-case crew. Note the device_if all over the place. I tried making that a condition for the whole lot, but Karabiner really wants it per rule. (I asked!)

I didn't want to lose ISO's extra key, but I did want to use it as left Shift whenever I mistakenly reach for it, tucked away down there where Shift alone should be. The rule here neatly transforms ` to left Shift on the fly, whenever it's pressed in combination with other keys. Otherwise, it works like normal: ````. See!

I'm used to ` being up top, left of 1, so I put it up there too. It's really useful for typing gràvè àccènts and for Command + ` window cycling. But I can reclaim the §/± key by throwing Fn at it when I want. Complex rules are pretty sweet!

One of these rules is inactive: "Built in Keyboard: ❌ Backslash ⇨ Return or Backslash with Right Option". The big red cross in its name is a note to self, seeing as there's no comments allowed in JSON. I did try this one initially, but my fingers are adapting back to skinny assed ISO Return now, so the extension into \ is more trouble than it's worth. I'll delete it eventually.

And finally a numpad layer to match my SSK, Realforce and indeed the PowerBook:

Code: Select all

{
	"title": "🔢 Numpad Layer",
	"rules":
	[
		{
			"description": "🔢 Hold Fn + I square keys ⇨ 🔢 Numpad",
			"manipulators": [
				{
				"type": "basic",
					"from": {
						"key_code": "j",
						"modifiers": {
							"mandatory": ["fn"]
						}
					},
					"to": [
					{
						"key_code": "keypad_1"
					}
					]
				},
				{
				"type": "basic",
					"from": {
						"key_code": "k",
						"modifiers": {
							"mandatory": ["fn"]
						}
					},
					"to": [
						{
							"key_code": "keypad_2"
						}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "l",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_3"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "u",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_4"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "i",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_5"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "o",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_6"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "7",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_7"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "8",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_8"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "9",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_9"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "0",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_0"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "m",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_0"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "comma",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_0"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "period",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_period"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "hyphen",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_hyphen"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "equal_sign",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_plus"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "slash",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_slash"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "semicolon",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_asterisk"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "return_or_enter",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_enter"
					}
					]
				}
			]
		},
		{
			"description": "🔢 Insert or  Option + Command + Command + Option ⇨ Toggle Numpad Layer",
			"manipulators": [
				{
					"from": {
						"key_code": "insert",
						"modifiers": {
							"optional": ["any"]
							}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 1
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 0
						}
					]
				},
				{
					"from": {
						"key_code": "insert",
						"modifiers": {
							"optional": ["any"]
							}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 0
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"from": {
						"key_code": "right_option",
						"modifiers": {
							"mandatory": ["left_option",
										  "left_command",
										  "right_command"]
						}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 1
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 0
						}
					]
				},
				{
					"from": {
						"key_code": "right_option",
						"modifiers": {
							"mandatory": ["left_option",
										  "left_command",
										  "right_command"]
						}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 0
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "j"
					},
					"to": [
						{
							"key_code": "keypad_1"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "k"
					},
					"to": [
						{
							"key_code": "keypad_2"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "l"
					},
					"to": [
						{
							"key_code": "keypad_3"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "u"
					},
					"to": [
						{
							"key_code": "keypad_4"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "i"
					},
					"to": [
						{
							"key_code": "keypad_5"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "o"
					},
					"to": [
						{
							"key_code": "keypad_6"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "7"
					},
					"to": [
						{
							"key_code": "keypad_7"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "8"
					},
					"to": [
						{
							"key_code": "keypad_8"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "9"
					},
					"to": [
						{
							"key_code": "keypad_9"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "0"
					},
					"to": [
						{
							"key_code": "keypad_0"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "m"
					},
					"to": [
						{
							"key_code": "keypad_0"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "comma"
					},
					"to": [
						{
							"key_code": "keypad_0"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "period"
					},
					"to": [
						{
							"key_code": "keypad_period"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "hyphen"
					},
					"to": [
						{
							"key_code": "keypad_hyphen"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "equal_sign"
					},
					"to": [
						{
							"key_code": "keypad_plus"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "slash"
					},
					"to": [
						{
							"key_code": "keypad_slash"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "semicolon"
					},
					"to": [
						{
							"key_code": "keypad_asterisk"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "return_or_enter"
					},
					"to": [
						{
							"key_code": "keypad_enter"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				}
			]
		}
	]
}
These ones are extra complex, as they store state. That's what all the variable_if stuff is about. It is essentially a soft numlock, as the Mac has no such mode.

Something I'm still not settled on is the perfect "Num Lock" toggle key. I've thrown it on Insert for my external keyboards, just because they all have that (they're mostly TKLs) and it's easily found. On my Mac's built in keyboard, however, it's a trickier call. I put it on Option + Option for a while, but acc5denta3 presses are rea33y q45te d5sr4pt5ve0, so I hid it behind a bigger combo I'm less likely to trigger falsely. Guess my fingers are lazier on those mods than I think!

Anyway, a few months into having this Air now, and I'm well pleased. Karabiner's patched this pretty wee keyboard to the point it mostly stays off my tits—what a relief!—and my external keyboards are all getting some new tricks now too. I haven't even started using app-specific logic yet, something only a host-run software like Karabiner can even dream to do. That vortex awaits me, should I dare.

(If you want to complain about my sloppy, inconsistent formatting, feel free. I am not a programmer! This JSON stuff is all new to me, and I did a lot of trial and copypasta. That's a spicy meatball!)
Last edited by Muirium on 27 Apr 2021, 10:35, edited 2 times in total.

User avatar
XMIT
[ XMIT ]

23 Mar 2021, 13:17

Great write up Mu. I am all for Karabiner on the macOS. I did a deep dive a while ago when working with a vendor to develop a Mac specific keyboard. The Apple keyboard driver stack is a weird thing, giving preferential treatment to keyboards with an Apple dev ID. Karabiner has an actual kernel module and is the best - possibly only - way to do complex mods on the Mac.

Think of it as a Soarer’s Converter running on your Mac. :)

User avatar
Muirium
µ

24 Mar 2021, 09:46

Thanks.

I’m usually one for running stock, as best I can. But Apple’s oh so pretty ISO UK was just bugging me too much. ‘who’s idea was it to shorten ‘shift of all keys in the first place/ ‘bloody maddening1 ‘what the actual duck/ Image

ISO and me aren’t exactly close friends, but Karabiner helps us make do together. And once I got used to that, I embraced its fruity powers.

User avatar
Muirium
µ

27 Apr 2021, 10:11

Update to Shift + Backspace ⇨ Delete rule:

Code: Select all

	    {
	        "description": "Shift + Backspace ⇨ Delete",
	        "manipulators": [
	            {
	            	"conditions": [
						{
							"type": "frontmost_application_if",
							"bundle_identifiers": [
								"com.apple.finder"
							]
						}
					],
	                "from": {
	                    "key_code": "delete_or_backspace",
	                    "modifiers": {
	                        "mandatory": [
	                            "shift"
	                        ],
	                        "optional": [
	                            "option"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "delete_forward"
	                    }
	                ],
	                "type": "basic"
	            },
	         	{
					"conditions": [
						{
							"type": "frontmost_application_unless",
							"bundle_identifiers": [
								"com.apple.finder"
							]
						}
					],
	                "from": {
	                    "key_code": "delete_or_backspace",
	                    "modifiers": {
	                        "mandatory": [
	                            "shift"
	                        ],
	                        "optional": [
	                            "any"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "delete_forward"
	                    }
	                ],
	                "type": "basic"
	            }

	        ]
	    },
This gives it the full chording capabilities of a Delete key. Specifically:

Shift + Option + Backspace ⇨ Option + Delete ⇨ delete word to the right
Shift + Command + Backspace ⇨ Command + Delete ⇨ delete line to the right

The last one is also the Empty Trash shortcut in the Finder, which works again now I spotted it and created the Finder specific exception. :P

micmil

28 Apr 2021, 02:08

Tiny Left Shift should not exist. You know what Tiny Left Shift is? Tiny Left Shift is Hitler's Mustache. It sprang to life, ran off to Brazil, and has been popping out clones of itself every since. One day all of the Tiny Left Shifts will rise up and try to take over the world, but then realize they're non-sentient inanimate objects and go back to being useless.

We will never know how close we came to destruction.

User avatar
kbdfr
The Tiproman

28 Apr 2021, 08:22

Funny how millions and millions of ISO users have no problem at all with the short left Shift.
Might be due to the simple fact that they are used to it because it is ISO standard.

Or do the millions of drivers in countries with left-hand traffic drive on the wrong side of the road?

User avatar
Muirium
µ

28 Apr 2021, 10:17

We all drive on the wrong side of the road, if you really think about it. Especially when you’re on a narrow Scottish country road and there’s a bloody tour bus sauntering around in front that you’re really needing past, preferably today. :lol:

How are you at typing on a mischievously small Right Shift I wonder? The good thing about computers is we can program our way around these obstacles when they present themselves.

My Left Shift extender and Shift + Backspace for reversing Delete are second nature to me now. Use them both countless times a day.

User avatar
kbdfr
The Tiproman

28 Apr 2021, 10:34

Muirium wrote:
28 Apr 2021, 10:17
We all drive on the wrong side of the road, if you really think about it. Especially when you’re on a narrow Scottish country road and there’s a bloody tour bus sauntering around in front that you’re really needing past, preferably today. :lol:
I must confess I did not know there are tour buses in Scotland. Is an ox cart not enough for the two and a half tourists? :lol:
How are you at typing on a mischievously small Right Shift I wonder? The good thing about computers is we can program our way around these obstacles when they present themselves. […]
Correct, I was glad I could reprogram that irritatingly huge 2u Backspace to the 1u it deserves (particularly regarding how rarely it is used).

User avatar
Muirium
µ

28 Apr 2021, 10:37

1u Backspace? Now that’s fighting talk, sonny!

User avatar
XMIT
[ XMIT ]

28 Apr 2021, 13:40

Are we surprised that a Frenchman never makes mistakes and doesn’t need a Backspace key?

Beware the angry Scotsman, lest he come at you with his caber.


I personally never use Left Shift. On some space constrained keyboards I will remap it to something else.

</soapbox>

User avatar
zrrion

28 Apr 2021, 14:15

I am the opposite way myself, never use right shift and on unfriendly layouts it normally gets sacrificed for something more valuable

User avatar
fohat
Elder Messenger

28 Apr 2021, 14:57

kbdfr wrote:
28 Apr 2021, 08:22

millions of ISO users have no problem at all with the short left Shift
Muirium wrote:
28 Apr 2021, 10:17

How are you at typing on a mischievously small Right Shift I wonder?
For me, the problem is muscle memory. After decades of ANSI keyboard use, and after doing some experimentation with odd vintage layouts, I understand that I customarily tap the inside (right end) of Left Shift, the outside (right end) of Right Shift.

Also, tangentially, I now know that usually touch the inside (left end) of Backspace and use my right thumb on the space bar 2/3 of the time and the left thumb 1/3 of the time.

I also love the Enter on the numpad and use it regularly.
Last edited by fohat on 28 Apr 2021, 16:03, edited 1 time in total.

User avatar
Muirium
µ

28 Apr 2021, 15:36

This is where ABS shine helps out. My laptops always get worn pretty quick, and this one here says my usual pattern still applies:
  • Spacebar heavily worn on the right, under NM with a much lighter secondary patch (my left hand) under CV.
  • ISO Return pressed exclusively on its lower deck, where ANSI Return should be!
  • Left Shift (and its sneaky extension) well worn, Right Shift not so much, but dead centre on its long, long length.
  • Backspace well used, again hit dead centre.
  • Both Tab and Caps Lock(!) getting a good deal of shine. The latter because I map it to Control! Fscking worse than useless to me otherwise.
  • Bottom row mods all showing shine, especially the right Option key, which I'm using for Enter as I described in the OP.
As for the rest of you nutjobs: a board without two Shifts ain't worth none to me. Are you seriously hunt and pecking me? :lol:

xxhellfirexx

29 Apr 2021, 08:20

Since we are sharing Karabiner scripts, here are a few I use with my IBM AT and 5251.

Image



Pressing and holding a key in the number row will trigger the corresponding function key. That way I do not have to press numlock to switch to the second layer, which I sometimes forget to turn off as there is no indicator light.

Code: Select all

{
  "title": "Trigger corresponding F1-F12 key when num row key is held down",
  "rules": [
    {
      "description": "Trigger corresponding F1-F12 key when num row key is held down",
      "manipulators": [
        {
            "type": "basic",
            "from": {
                "key_code": "1"
            },
            "to_after_key_up": [
                {
                    "key_code": "1"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f1",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "2"
            },
            "to_after_key_up": [
                {
                    "key_code": "2"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f2",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "3"
            },
            "to_after_key_up": [
                {
                    "key_code": "3"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f3",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "4"
            },
            "to_after_key_up": [
                {
                    "key_code": "4"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f4",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "5"
            },
            "to_after_key_up": [
                {
                    "key_code": "5"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f5",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "6"
            },
            "to_after_key_up": [
                {
                    "key_code": "6"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f6",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "7"
            },
            "to_after_key_up": [
                {
                    "key_code": "7"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f7",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "8"
            },
            "to_after_key_up": [
                {
                    "key_code": "8"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f8",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "9"
            },
            "to_after_key_up": [
                {
                    "key_code": "9"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f9",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "0"
            },
            "to_after_key_up": [
                {
                    "key_code": "0"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f10",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "hyphen"
            },
            "to_after_key_up": [
                {
                    "key_code": "hyphen"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f11",
                    "halt": true
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "equal_sign"
            },
            "to_after_key_up": [
                {
                    "key_code": "equal_sign"
                }
            ],
            "to_if_held_down": [
                {
                    "key_code": "f12",
                    "halt": true
                }
            ]
        }
      ]
    }
  ]
}
I doubled up the left control and caps lock key on the IBM AT as there are not enough modifier keys. If the left control key is pressed by itself, I get caps lock. If the left control key is press with another key, I get control.

Code: Select all

{
  "title": "Change caps_lock key (rev 4)",
  "rules": [
    {
      "description": "Change left_control to caps_lock unless pressed with other keys.",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "left_control",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "caps_lock",
              "hold_down_milliseconds": 500
            }
          ]
        }
      ]
    },
    {
      "description": "Disable caps_lock delay",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "vk_none"
            }
          ]
        }
      ]
    }
  ]
}
To deal with the single unit backspace, I use the following macro. It allows me to press and hold either shift key and tap the other shift key to backspace.

Code: Select all

{
  "title": "Both shift = backspace.",
  "rules": [
    {
      "description": "Both shift = backspace.",
      "manipulators": [
        {
            "type": "basic",
            "from": {
                "key_code": "left_shift",
                "modifiers": {
                    "mandatory": ["right_shift"]
                }
            },
            "to": [
                {
                    "key_code": "delete_or_backspace",
                    "lazy": true
                }
            ],
            "to_if_alone": [
                {
                    "key_code": "left_shift"
                }
            ]
        },
        {
            "type": "basic",
            "from": {
                "key_code": "right_shift",
                "modifiers": {
                    "mandatory": ["left_shift"]
                }
            },
            "to": [
                {
                    "key_code": "delete_or_backspace",
                    "lazy": true
                }
            ],
            "to_if_alone": [
                {
                    "key_code": "right_shift"
                }
            ]
        }
      ]
    }
  ]
}
If I tap both shifts simultaneously twice, I can delete one word.

Code: Select all

{
	"title": "Both shift 2x = delete word.",
	"rules": [
	{
		"description": "Both shift 2x = delete word.",
		"manipulators": [
		{
		    "type": "basic",
			"from": {
				"simultaneous": [
					{
						"key_code": "left_shift"
					},
					{
						"key_code": "right_shift"
					}
				],
				"modifiers": {
					"optional": [
						"any"
					]
				}
			},
		    "to": [
		        {
		            "key_code": "delete_or_backspace",
					"modifiers":[
						"right_option"
					]
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "both_shift pressed",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
			"from": {
				"simultaneous": [
					{
						"key_code": "left_shift"
					},
					{
						"key_code": "right_shift"
					}
				],
				"modifiers": {
					"optional": [
						"any"
					]
				}
			},
		    "to": [
		        {
		            "set_variable": {
		                "name": "both_shift pressed",
		                "value": 1
		            }
		        }
		    ],
		    "to_delayed_action": {
		        "to_if_invoked": [
		            {
		                "set_variable": {
		                    "name": "both_shift pressed",
		                    "value": 0
		                }
		            }
		        ],
		        "to_if_canceled": [
		            {
		                "set_variable": {
		                    "name": "both_shift pressed",
		                    "value": 0
		                }
		            }
		        ]
		    }
		}
		]
    }
	]
}
Thanks Muirium for the Shift + Backspace = Delete macro as I usually use the numpad period, which is inaccessible with numlock enabled.

Code: Select all

{
  "title": "Shift + Backspace = Delete",
  "rules": [
    {
      "description": "Shift + Backspace = Delete",
      "manipulators": [
        {
            "type": "basic",
            "from": {
                "key_code": "delete_or_backspace",
                "modifiers": {
                    "mandatory": ["shift"]
                }
            },
            "to": [
                {
                    "key_code": "delete_forward"
                }
            ]
        }
      ]
    }
  ]
}
Last edited by xxhellfirexx on 30 Apr 2021, 06:13, edited 1 time in total.

User avatar
Muirium
µ

29 Apr 2021, 11:08

Always pleased to spread the remap + macro love! Some inventive thinking at work in your collection. Might steal one or two myself. :D

Big Ass Enter is the mighty AT's most prominent flaw, far as I'm concerned. I took another approach to remapping that PAR-TIC-ULAR key. I did away with it in the physical hardware! Here's my µAT as she is right now:

IMG_9060.jpg
IMG_9060.jpg (1.01 MiB) Viewed 146640 times
A few modifications on show here. I've not the stones to attempt a full ANSI mod, and I actually quite like the vintage weighted spacebar anyway. So that stays. I just took off Big Ass, swapped in some harvested flippers, and split it into a real ANSI Return and 1.5u HHKB style Backspace key. Well, a Tab key, but my fingers don't mind! I completed the HHKB top row, with matching legends, and played around with the Numpad, giving it navigation keys. Oh, and installed a Fn' Lenin.

Here's the actual layout, in QMK:

Screenshot 2021-04-29 at 9.43.58 am.jpg
Screenshot 2021-04-29 at 9.43.58 am.jpg (191.99 KiB) Viewed 146640 times
I used my ancient approach with Model Fs and spread the full suite of modern modifiers along the bottom row of the function columns. No need to twiddle them on shared keys when you've hardware down there to map them on, already.

(Though I do agree that combining a real mod and Caps Lock with one-touch logic is smart, especially on tiny boards.)

The pochled numpad was originally just to fill out the block, once I'd added the arrow keys I really wanted. But I find it's actually quite useful. Especially that Numpad Enter in the corner. I habitually assume that key is Enter on larger boards. It's a nice quick one to always have.

I threw my regular HHKB navigation layer on Layer 1, as I always do. For a long time, I used the one key right of the spacebar as my HHKB style Fn, that's why it's an icon legend Shift: an upwards pointing arrow to remind me it shifts up a layer! But this arrow-keyed AT has less need for all that than my Kishsaver. So I switched it back to right Command—a key I really need—and let Ln handle the second layer instead. What's actually useful up there is the mouse keys I put on the numpad. Hit Vladimir, and you toggle into mouse mode: handy when typing with the AT on your lap and need to go hit something quick.

Yes, there's a Caps Lock up on Ln + Tab but that's just a fallback for the iPad or any other machine not running Karabiner. What I really use is Shift + Shift for Caps Lock; but I've not figured out how to code up macros in QMK.

Last but not least: where's the cable? Ah, well, I added a USB C port in the original opening on the back. This µAT has a more modern connector than those damn Unicomp SSKs! :lol:
Last edited by Muirium on 29 Apr 2021, 11:31, edited 1 time in total.

User avatar
Bjerrk

29 Apr 2021, 11:30

Muirium wrote:
23 Mar 2021, 12:52
The legends… they're all true?
Until you remap.

User avatar
Muirium
µ

29 Apr 2021, 11:42

Indeed! Always a risk when you're getting fancy.

The legends on my Mac's built in keyboard are, in fact, all still true. Well, okay Caps Lock may be Control now, but its LED indicator is still faithful to its icon! Really, I just happened to add some extra functions. Some of them were simply lost in time. Prime example: the missing numeric layer from my PowerBook, now also present on the M1 thanks to Karabiner.

PowerBook embedded numpad.gif
PowerBook embedded numpad.gif (97.12 KiB) Viewed 146620 times
I usually just hold Fn to type numbers with my right hand, which worked back then as well, as shown in Apple's long forgotten diagram. No way to restore the old PowerBooks' little yellow-green Num Lock LED on F6 though.

Now yes, my vintage keyboards like the Kishsaver and especially the AT are another matter! That's why I prize consistency in my screwing around. If I can remember all my monkey business well enough, then I don't need to go look at what the lying keys say. :roll:

User avatar
Muirium
µ

01 May 2021, 11:11

Thanks to xxhellfirexx (whose to_delayed_action-fu is well ahead of mine) I've added a bunch of extra twiddly double-tap stuff. They also clued me into why "key_code": "spotlight" doesn't work, so I've cleaned up my media keys too.

Double Tap toggles:

Code: Select all

	    {
	    	"description": "Right Command double tap ⇨ 🔍 Spotlight",
	    	"manipulators": [
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_command",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": [
	    				{
	    					"apple_vendor_keyboard_key_code": "spotlight"
	    				}
	    			],
	    			"conditions": [
	    				{
	    					"type": "variable_if",
	    					"name": "right_command pressed",
	    					"value": 1
	    				}
	    			]
	    		},
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_command",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": [
	    				{
	    					"set_variable": {
	    						"name": "right_command pressed",
	    						"value": 1
	    					}
	    				},
	    				{
	    					"key_code": "right_command"
	    				}
	    			],
	    			"to_delayed_action": {
	    				"to_if_invoked": [
	    					{
	    						"set_variable": {
	    							"name": "right_command pressed",
	    							"value": 0
	    						}
	    					}
	    				],
	    				"to_if_canceled": [
	    					{
	    						"set_variable": {
	    							"name": "right_command pressed",
	    							"value": 0
	    						}
	    					}
	    				]
	    			}
	    		}
	    	]
	    },
	    {
	    	"description": "Right Shift double tap ⇨ ⇪ Caps Lock",
	    	"manipulators": [
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_shift",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": [
	    				{
	    					"key_code": "caps_lock"
	    				}
	    			],
	    			"conditions": [
	    				{
	    					"type": "variable_if",
	    					"name": "right_shift pressed",
	    					"value": 1
	    				}
	    			]
	    		},
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_shift",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": [
	    				{
	    					"set_variable": {
	    						"name": "right_shift pressed",
	    						"value": 1
	    					}
	    				},
	    				{
	    					"key_code": "right_shift"
	    				}
	    			],
	    			"to_delayed_action": {
	    				"to_if_invoked": [
	    					{
	    						"set_variable": {
	    							"name": "right_shift pressed",
	    							"value": 0
	    						}
	    					}
	    				],
	    				"to_if_canceled": [
	    					{
	    						"set_variable": {
	    							"name": "right_shift pressed",
	    							"value": 0
	    						}
	    					}
	    				]
	    			}
	    		}
	    	]
	    }
I've been hankering after right Command x2 to trigger search ever since my old Quicksilver days. Now I've got it back! Triggering it with just one finger feels so much quicker to me than even Command + Space. Love it! You've got my thanks! 8-)

Note the rather ungainly "apple_vendor_keyboard_key_code": "spotlight". That's how Karabiner describes the dedicated Spotlight key. xxhellfirexx showed me how to do it with a Command + Space macro but I wanted to get to the bottom of this, as I was having trouble with other media keys anyway.

I also threw in right Shift x2 for Caps Lock because I wanted to see if I understand it. Kinda! This also clued me into the need to treat Caps Lock as a modifier in other definitions. My first attempt actually disabled Command x2 whenever Caps Lock was engaged! Good to know to look for it.

So, about those media keys:

Code: Select all

		{
			"description": "Navigation Sixpack lock row ⇨ 🔉 Volume keys",
			"manipulators": [
				{
					"from": {
						"key_code": "print_screen",
						"modifiers": {
							"optional": ["any"]
						}
					},
					"to": [
						{
							"consumer_key_code": "mute",
							"repeat": "true"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "keypad_num_lock",
						"modifiers": {
							"optional": ["any"]
						}
					},
					"to": [
						{
							"consumer_key_code": "mute",
							"repeat": "true"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "scroll_lock",
						"modifiers": {
							"optional": ["any"]
						}
					},
					"to": [
						{
							"key_code": "volume_decrement",
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "pause",
						"modifiers": {
							"optional": ["any"]
						}
					},
					"to": [
						{
							"key_code": "volume_increment",
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "Fine Volume: Command ± 🔉 ⇨ Shift + Option ± 🔉",
			"manipulators": [
				{
					"from": {
						"key_code": "volume_decrement",
						"modifiers": {
							"mandatory": ["command"]
						}
					},
					"to": [
							{
								"key_code": "volume_decrement",
								"modifiers": [
									"left_shift",
									"left_alt"
								],
								"repeat": true
							}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f11",
						"modifiers": {
							"mandatory": ["command"]
						}
					},
					"to": [
							{
								"key_code": "volume_decrement",
								"modifiers": [
									"left_shift",
									"left_alt"
								],
								"repeat": true
							}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "volume_increment",
						"modifiers": {
							"mandatory": ["command"]
						}
					},
					"to": [
						{
							"key_code": "volume_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f12",
						"modifiers": {
							"mandatory": ["command"]
						}
					},
					"to": [
						{
							"key_code": "volume_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "Fine Brightness: Command ± 🔅 ⇨ Shift + Option ± 🔅",
			"manipulators": [
				{
					"from": {
						"key_code": "display_brightness_decrement",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_decrement",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f1",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_decrement",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "display_brightness_increment",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "Contrast: Control ± 🔅 ⇨ Control + Option + Command ± .",
			"manipulators": [
				{
					"from": {
						"consumer_key_code": "display_brightness_decrement",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "period",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f1",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "period",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"consumer_key_code": "display_brightness_increment",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "comma",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "comma",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		}
Still need to test these media shortcuts with the usual suspects: my Realforce (with its misplaced Num Lock key where Print Screen usually lies), the Filco and the Novatouch. But I reckon they're right now, supporting Mute everywhere, thanks to now knowing its true name: "consumer_key_code": "mute" :roll:

I'll wrap these into the OP rules once they're tested.

Believe it or not, I'm trying to make things cleaner to use. My goal is to have no fiddly, mousy per-keyboard "Simple Modifications" at all, and let rule logic figure all this stuff out, whenever I hook up a different board. We'll see. It's either this or a bunch of Hasu USB to USB converters! Nooo! :lol:

Oh, and then there's the unfinished business of trying to use right Option x2 as my soft Num Lock layer lock, which involves monkeying around with its added Enter function *and* twiddling two state variables at once. Maybe I could put it on one of those hold triggers of yours, like your function row. I'll, uh, come back to that…

User avatar
Muirium
µ

01 May 2021, 15:30

Here's just a little fruity something I'm playing with:

Code: Select all

{
	"title": "🖱 Mouse Keys",
	"rules": [
		{
			"description": "Press and hold HHKB style 🖱 keys",
			"manipulators": [
				{
					"type": "basic",
					"from": {
						"key_code": "semicolon"
					},
					"to_after_key_up": [
						{
							"key_code": "semicolon"
						}
					],
					"to_if_held_down": [
						{
							"mouse_key": {
								"x": -1536
							},
							"halt": true
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "quote"
					},
					"to_after_key_up": [
						{
							"key_code": "quote"
						}
					],
					"to_if_held_down": [
						{
							"mouse_key": {
								"x": 1536
							},
							"halt": true
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "open_bracket"
					},
					"to_after_key_up": [
						{
							"key_code": "open_bracket"
						}
					],
					"to_if_held_down": [
						{
							"mouse_key": {
								"y": -1536
							},
							"halt": true
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "slash"
					},
					"to_after_key_up": [
						{
							"key_code": "slash"
						}
					],
					"to_if_held_down": [
						{
							"mouse_key": {
								"y": 1536
							},
							"halt": true
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "l"
					},
					"to_after_key_up": [
						{
							"key_code": "l"
						}
					],
					"to_if_held_down": [
						{
							"mouse_key": {
								"vertical_wheel": -32
							},
							"halt": true
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "period"
					},
					"to_after_key_up": [
						{
							"key_code": "period"
						}
					],
					"to_if_held_down": [
						{
							"mouse_key": {
								"vertical_wheel": 32
							},
							"halt": true
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "p"
					},
					"to_after_key_up": [
						{
							"key_code": "p"
						}
					],
					"to_if_held_down": [
						{
							"pointing_button": "button1",
							"halt": true
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "close_bracket"
					},
					"to_after_key_up": [
						{
							"key_code": "close_bracket"
						}
					],
					"to_if_held_down": [
						{
							"pointing_button": "button2",
							"halt": true
						}
					]
				}
			]
		}
	]
}
Handy so far! Let's see how long they take to trip me ass over teakettle. :lol:

Edit: Actually, that did not take long! Just typing kettel kettel, damn it kett…le is affected by just enough key up delay I'm out typing it myself and getting the wrong order. Rats! Shame, because mouse keys (namely keyboard on lap keys!) are really nice without needing to hodl (<< dodgy L key!) some other key down with them, or needing to remember where the mode lock lives. Lemme see what I can do.

User avatar
Muirium
µ

04 May 2021, 10:59

Okay, no amount of fiddling with to_if_held_down_threshold fixed those lazy keys. So I'm trying something different. How about a mousing mode, toggled by double tapping right Shift? That key's on all my keyboards, and I kinda sorta know how to do double taps and layers now. So let's mix them both! What could possibly go wrong? (Spoiler: something went wrong…)

My current attempt:

Code: Select all

{
	"title": "🖱 Mouse Keys",
	"rules": [
		{
	    	"description": "Right Shift double tap ⇨ 🖱 keys layer lock",
	    	"manipulators": [
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_shift",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": {
						"set_variable": {
							"name": "mouse_keys_mode",
							"value": 1
						}
					},
	    			"conditions": [
	    				{
	    					"type": "variable_if",
	    					"name": "right_shift pressed",
	    					"value": 1
	    				},
	    				{
	    					"type": "variable_if",
	    					"name": "mouse_keys_mode",
	    					"value": 0
	    				}
	    			]
	    		},
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_shift",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": [
	    				{
	    					"set_variable": {
	    						"name": "right_shift pressed",
	    						"value": 1
	    					}
	    				},
	    				{
	    					"key_code": "right_shift"
	    				}
	    			],
	    			"to_delayed_action": {
	    				"to_if_invoked": [
	    					{
	    						"set_variable": {
	    							"name": "right_shift pressed",
	    							"value": 0
	    						}
	    					}
	    				],
	    				"to_if_canceled": [
	    					{
	    						"set_variable": {
	    							"name": "right_shift pressed",
	    							"value": 0
	    						}
	    					}
	    				]
	    			}
	    		},
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_shift",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": {
						"set_variable": {
							"name": "mouse_keys_mode",
							"value": 0
						}
					},
	    			"conditions": [
	    				{
	    					"type": "variable_if",
	    					"name": "right_shift pressed",
	    					"value": 1
	    				},
	    				{
	    					"type": "variable_if",
	    					"name": "mouse_keys_mode",
	    					"value": 1
	    				}
	    			]
	    		},
	    		{
	    			"type": "basic",
	    			"from": {
	    				"key_code": "right_shift",
	    				"modifiers": {
	    					"optional": [
	    						"caps_lock"
	    					]
	    				}
	    			},
	    			"to": [
	    				{
	    					"set_variable": {
	    						"name": "right_shift pressed",
	    						"value": 1
	    					}
	    				},
	    				{
	    					"key_code": "right_shift"
	    				}
	    			],
	    			"to_delayed_action": {
	    				"to_if_invoked": [
	    					{
	    						"set_variable": {
	    							"name": "right_shift pressed",
	    							"value": 0
	    						}
	    					}
	    				],
	    				"to_if_canceled": [
	    					{
	    						"set_variable": {
	    							"name": "right_shift pressed",
	    							"value": 0
	    						}
	    					}
	    				]
	    			}
	    		},
	    		{
					"type": "basic",
					"from": {
						"key_code": "semicolon"
					},
					"to": [
						{
							"mouse_key": {
								"x": -1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "quote"
					},
					"to": [
						{
							"mouse_key": {
								"x": 1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "open_bracket"
					},
					"to": [
						{
							"mouse_key": {
								"y": -1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "slash"
					},
					"to": [
						{
							"mouse_key": {
								"y": 1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "l"
					},
					"to": [
						{
							"mouse_key": {
								"vertical_wheel": -32
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "period"
					},
					"to": [
						{
							"mouse_key": {
								"vertical_wheel": 32
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "p"
					},
					"to": [
						{
							"pointing_button": "button1",
							"halt": true
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "close_bracket"
					},
					"to": [
						{
							"pointing_button": "button2",
							"halt": true
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				}
			]
		}
	]
}
Almost there now! Just one problem: I can't toggle back out of Mouse Keys mode. Anyone know what I'm doing wrong with the latch?


Edit: Much to my continued amusement, it really doesn't work how I think it should. Check this out. I thought "hey, for now let's just copy paste the set variable mouse_keys_mode = 0 exit stuff on my known good old Shift + Shift ⇨ Caps Lock instead. That way I can at least get back out again quick and dirty style. What could possibly…” So I did this:

Code: Select all

	    {
	        "description": "Shift + Shift ⇨ ⇪ Caps Lock",
	        "manipulators": [
	            {
	                "from": {
	                    "key_code": "left_shift",
	                    "modifiers": {
	                        "mandatory": [
	                            "right_shift"
	                        ],
	                        "optional": [
	                            "any"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "caps_lock",
	                        "set_variable": {
								"name": "mouse_keys_mode",
								"value": 0
							}
	                    }
	                ],
	                "type": "basic"
	            },
	            {
	                "from": {
	                    "key_code": "right_shift",
	                    "modifiers": {
	                        "mandatory": [
	                            "left_shift"
	                        ],
	                        "optional": [
	                            "any"
	                        ]
	                    }
	                },
	                "to": [
	                    {
	                        "key_code": "caps_lock",
	                        "set_variable": {
								"name": "mouse_keys_mode",
								"value": 0
							}
	                    }
	                ],
	                "type": "basic"
	            }
	        ]
	    },
And what actually happens? Mouse keys layer successfully deactivated when I engage Caps Lock, but now Caps Lock itself is broken, and toggling both then gets me stuck in mouse keys again. :roll:

What that even mean!? Well, besides I clearly don't know what I'm doin' rong. :P

xxhellfirexx

06 May 2021, 07:03

Muirium wrote:
04 May 2021, 10:59
And what actually happens? Mouse keys layer successfully deactivated when I engage Caps Lock, but now Caps Lock itself is broken, and toggling both then gets me stuck in mouse keys again. :roll:

What that even mean!? Well, besides I clearly don't know what I'm doin' rong. :P
Here is a fixed version of the mouse keys toggle.

Code: Select all

{
	"title": "Right Shift x2 = Mouse keys mode",
	"description": "semicolon = left, quote = right, open_bracket = up, slash = down, l = scroll up, period = scroll down, p = left click, close_bracket = right click",
	"rules": [
	{
		"description": "Right Shift x2 = Mouse keys mode",
		"manipulators": [
		{
		    "type": "basic",
				"description": "semicolon (;) = Move pointer left",
				"from": {
		        "key_code": "semicolon",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"mouse_key": {
								"x": -1536
							}
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
				"description": "quote (\") = Move pointer right",
				"from": {
		        "key_code": "quote",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"mouse_key": {
								"x": 1536
							}
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
				"description": "open_bracket ([) = Move pointer up",
				"from": {
		        "key_code": "open_bracket",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"mouse_key": {
								"y": -1536
							}
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
				"description": "slash (/) = Move pointer down",
				"from": {
		        "key_code": "slash",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"mouse_key": {
								"y": 1536
							}
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
				"description": "L (l) = Scroll up",
				"from": {
		        "key_code": "l",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"mouse_key": {
								"vertical_wheel": -32
							}
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
				"description": "period (.) = Scroll down",
				"from": {
		        "key_code": "period",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"mouse_key": {
								"vertical_wheel": 32
							}
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
				"description": "P (p) = Left click",
				"from": {
		        "key_code": "p",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"pointing_button": "button1",
							"halt": true
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},

		{
		    "type": "basic",
				"description": "close_bracket (]) = Right click",
				"from": {
		        "key_code": "close_bracket",
						"modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
							"pointing_button": "button2",
							"halt": true
		        }
		    ],
		    "conditions": [
		        {
		            "type": "variable_if",
		            "name": "mouse_keys enabled",
		            "value": 1
		        }
		    ]
		},




		{
				"type": "basic",
				"description": "After right shift pressed the second time, enable mouse keys if not enabled yet.",
				"from": {
		        "key_code": "right_shift",
		        "modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
		            "set_variable": {
		                "name": "mouse_keys enabled",
		                "value": 1
		            }
		        },
						{
								"key_code": "right_shift"
						}
		    ],
				"conditions": [
						{
								"type": "variable_if",
								"name": "right_shift pressed",
								"value": 1
						},
						{
								"type": "variable_if",
								"name": "mouse_keys enabled",
								"value": 0
						}
				]
		},


		{
				"type": "basic",
				"description": "After right shift pressed the second time, disable mouse keys if it is enabled.",
				"from": {
		        "key_code": "right_shift",
		        "modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
				"to": [
		        {
		            "set_variable": {
		                "name": "mouse_keys enabled",
		                "value": 0
		            }
		        },
						{
								"key_code": "right_shift"
						}
		    ],
				"conditions": [
						{
								"type": "variable_if",
								"name": "right_shift pressed",
								"value": 1
						},
						{
								"type": "variable_if",
								"name": "mouse_keys enabled",
								"value": 1
						}
				]
		},


		{
		    "type": "basic",
				"description": "Set right shift pressed to 1 when right shift is pressed. If time out in 500 ms (if invoked) or another key pressed (if canceled), set back to 0.",
				"from": {
		        "key_code": "right_shift",
		        "modifiers": {
		            "optional": [
		                "any"
		            ]
		        }
		    },
		    "to": [
		        {
		            "set_variable": {
		                "name": "right_shift pressed",
		                "value": 1
		            }
		        },
						{
								"key_code": "right_shift"
						}
		    ],
		    "to_delayed_action": {
		        "to_if_invoked": [
		            {
		                "set_variable": {
		                    "name": "right_shift pressed",
		                    "value": 0
		                }
		            }
		        ],
		        "to_if_canceled": [
		            {
		                "set_variable": {
		                    "name": "right_shift pressed",
		                    "value": 0
		                }
		            }
		        ]
		    }
		}
		]
    }
	]
}
Your caps lock script does not work well with the mouse keys script. So I replaced it with my version. The only difference is your script allows you to press and hold one shift then press the other shift to toggle caps lock. My script requires both shifts to be pressed together at the same time.

Code: Select all

{
	"title": "Both Shift = Caps Lock",
	"rules": [
	{
		"description": "Both Shift = Caps Lock",
		"manipulators": [
		{
		    "type": "basic",
			"from": {
				"simultaneous": [
					{
						"key_code": "left_shift"
					},
					{
						"key_code": "right_shift"
					}
				],
				"modifiers": {
					"optional": [
						"any"
					]
				}
			},
		    "to": [
		        {
		            "key_code": "caps_lock"
		        }
		    ]
		}
		
		]
    }
	]
}
Have fun and be careful to not put too many macros for the same keys (like shift in this case) or commonly used ones (like L and P) or you might accidentally fall into your own trapdoor.

User avatar
Muirium
µ

06 May 2021, 09:39

Fall into trap? Who, me? I’m just here for tasty, tasty doh…
Spoiler:
Image
Thanks for the edits! I’ll give them a shot.

Edit: So far, so good. I integrated your double tap Shift logic into my own and it's working a beaut. Thanks!

Shift + Shift > Caps Lock doesn't need modification, it still works well, unmodified. (And lets me be slower at engaging them without punishment.) I was tangling them together as a sanity check earlier, which had the opposite to its intended effect… :lol:

I'm also trialling a slight delay on my "Caps Lock" Control key, seeing as I keep hitting it in glancing, when typing A on my laptop, and getting taken to the beginning of paragraphs thanks to instantaneous Ctrl+A. A little damping does the trick. Just need to tune the exact delay so it never catches me out when I really mean Control.

User avatar
Muirium
µ

10 May 2021, 17:27

Updates!

General Rules for all keyboards.

Code: Select all

{
	"title": "General Complex Rules",
	"rules": [
		{
			"description": "⇪ Combo Caps Lock: Shift + Shift ⇨ ⇪ Caps Lock",
			"manipulators": [
				{
					"from": {
						"key_code": "left_shift",
						"modifiers": {
							"mandatory": [
								"right_shift"
							],
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "caps_lock"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "right_shift",
						"modifiers": {
							"mandatory": [
								"left_shift"
							],
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "caps_lock"
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "⌦ Forward Delete: Shift + Backspace ⇨ ⌦ Delete",
			"manipulators": [
				{
					"conditions": [
						{
							"type": "frontmost_application_if",
							"bundle_identifiers": [
								"com.apple.finder"
							]
						}
					],
					"from": {
						"key_code": "delete_or_backspace",
						"modifiers": {
							"mandatory": [
								"shift"
							],
							"optional": [
								"option"
							]
						}
					},
					"to": [
						{
							"key_code": "delete_forward"
						}
					],
					"type": "basic"
				},
				{
					"conditions": [
						{
							"type": "frontmost_application_unless",
							"bundle_identifiers": [
								"com.apple.finder"
							]
						}
					],
					"from": {
						"key_code": "delete_or_backspace",
						"modifiers": {
							"mandatory": [
								"shift"
							],
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "delete_forward"
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "⌥ Numpad Enter: Right ⌥ Option alone ⇨ 🗣 Enter",
			"manipulators": [
				{
					"type": "basic",
					"from": {
						"key_code": "right_option"
					},
					"to": [
						{
							"key_code": "right_option"
						}
					],
					"to_if_alone": [
						{
							"key_code": "keypad_enter"
						}
					]
				},
				{
					"from": {
						"key_code": "right_option",
						"modifiers": {
							"mandatory": [
								"right_command"
							]
						}
					},
					"to": [
						{
							"key_code": "s",
							"modifiers": [
								"right_command",
								"right_control"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "⇪ Caps Lock ⇨ Right ⌃ Control (guard on ⌃A)",
			"manipulators": [
				{
					"type": "basic",
					"from": {
						"key_code": "caps_lock",
						"modifiers": {
							"optional": [
								"any"
							]
						}
					},
					"to": {
						"key_code": "right_control"
					}
				},
				{
					"type": "basic",
					"from": {
						"simultaneous": [
							{
								"key_code": "a"
							},
							{
								"key_code": "right_control"
							}
						],
						"simultaneous_options": {
							"key_down_order": "strict"
						}
					},
					"to": {
						"key_code": "a"
					}
				}
			]
		},
		{
			"description": "🔍 Spotlight: Right ⌘ Command double tap ⇨ 🔍 Spotlight",
			"manipulators": [
				{
					"type": "basic",
					"from": {
						"key_code": "right_command",
						"modifiers": {
							"optional": [
								"caps_lock"
							]
						}
					},
					"to": [
						{
							"apple_vendor_keyboard_key_code": "spotlight"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "right_command pressed",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "right_command",
						"modifiers": {
							"optional": [
								"caps_lock"
							]
						}
					},
					"to": [
						{
							"set_variable": {
								"name": "right_command pressed",
								"value": 1
							}
						},
						{
							"key_code": "right_command"
						}
					],
					"to_delayed_action": {
						"to_if_invoked": [
							{
								"set_variable": {
									"name": "right_command pressed",
									"value": 0
								}
							}
						],
						"to_if_canceled": [
							{
								"set_variable": {
									"name": "right_command pressed",
									"value": 0
								}
							}
						]
					}
				}
			]
		},
		{
			"description": "⚙️ Preferences: ⌥ Option + 🔅 ⇨ Keyboard Preferences Pane",
			"manipulators": [
				{
					"from": {
						"consumer_key_code": "display_brightness_increment",
						"modifiers": {
							"mandatory": [
								"option"
							]
						}
					},
					"to": [
						{
							"apple_vendor_top_case_key_code": "illumination_up",
							"modifiers": [
								"option"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"option"
							]
						}
					},
					"to": [
						{
							"apple_vendor_top_case_key_code": "illumination_up",
							"modifiers": [
								"option"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "⚙️ Preferences: ⌥ Option + 🎙 ⇨ Sound Preferences Pane",
			"manipulators": [
				{
					"from": {
						"consumer_key_code": "dictation",
						"modifiers": {
							"mandatory": [
								"option"
							]
						}
					},
					"to": [
						{
							"consumer_key_code": "mute",
							"modifiers": [
								"option"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f5",
						"modifiers": {
							"mandatory": [
								"option"
							]
						}
					},
					"to": [
						{
							"consumer_key_code": "mute",
							"modifiers": [
								"option"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🔊 Navigation Sixpack lock row ⇨ 🔉 Volume keys",
			"manipulators": [
				{
					"from": {
						"key_code": "print_screen",
						"modifiers": {
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"consumer_key_code": "mute",
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "keypad_num_lock",
						"modifiers": {
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"consumer_key_code": "mute",
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "scroll_lock",
						"modifiers": {
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "volume_decrement",
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "pause",
						"modifiers": {
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "volume_increment",
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🔉 Fine Volume: ⌘ Command ± 🔉 ⇨ Shift + Option ± 🔉",
			"manipulators": [
				{
					"from": {
						"key_code": "volume_decrement",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "volume_decrement",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f11",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "volume_decrement",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "volume_increment",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "volume_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f12",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "volume_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🔅 Fine Brightness: ⌘ Command ± 🔅 ⇨ Shift + Option ± 🔅",
			"manipulators": [
				{
					"from": {
						"key_code": "display_brightness_decrement",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_decrement",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f1",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_decrement",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "display_brightness_increment",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"command"
							]
						}
					},
					"to": [
						{
							"key_code": "display_brightness_increment",
							"modifiers": [
								"left_shift",
								"left_alt"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🌟 Contrast: ⌃ Control ± 🔅 ⇨ Control + Option + Command ± .",
			"manipulators": [
				{
					"from": {
						"consumer_key_code": "display_brightness_decrement",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "period",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f1",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "period",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"consumer_key_code": "display_brightness_increment",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "comma",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "comma",
							"modifiers": [
								"left_control",
								"left_option",
								"left_command"
							],
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🌙 Keyboard Brightness: ⌘ Command + ⌥ Option ± 🔅 ⇨ Illumination Up / Down",
			"manipulators": [
				{
					"from": {
						"key_code": "display_brightness_decrement",
						"modifiers": {
							"mandatory": [
								"command",
								"option"
							]
						}
					},
					"to": [
						{
							"apple_vendor_top_case_key_code": "illumination_down",
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f1",
						"modifiers": {
							"mandatory": [
								"command",
								"option"
							]
						}
					},
					"to": [
						{
							"apple_vendor_top_case_key_code": "illumination_down",
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "display_brightness_increment",
						"modifiers": {
							"mandatory": [
								"command",
								"option"
							]
						}
					},
					"to": [
						{
							"apple_vendor_top_case_key_code": "illumination_up",
							"repeat": true
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "f2",
						"modifiers": {
							"mandatory": [
								"command",
								"option"
							]
						}
					},
					"to": [
						{
							"apple_vendor_top_case_key_code": "illumination_up",
							"repeat": true
						}
					],
					"type": "basic"
				}
			]
		}
	]
}
So what's new?
  • I've prettied these up with opening emoji names to make them easier to distinguish inside Karabiner.
  • Fixed up the Control + A trap, to spare me my occasional (and very disruptive) slips onto the Control key on my low profile laptop keyboard. It catches A + Control sequences (strictly in that order) and strips the Control off them. Might as well apply it to all keyboards. Well, until it ever bugs me. ;)
  • Added a logical handful of System Preferences shortcuts. All Macs support Option + Brightness ⇨ Display Settings and a few others, so I've filled out the list. Still need to add Accessibility though, probably needs a script.
  • Added keyboard backlight controls, on Command + Option + Brightness since modern Mac laptops strangely don't have those, but Big Sur still supports the keycodes.
MacBook Air specific rules:

Code: Select all

{
	"title": "Built in Keyboard Rules",
	"type": "device_if",
	"rules": [
		{
			"description": "💻 Built in Keyboard: § ⇨ ` (Fn to override)",
			"manipulators": [
				{
					"conditions": [
						{
							"type": "device_if",
							"identifiers": [
								{
									"vendor_id": 1452,
									"product_id": 641
								}
							]
						}
					],
					"type": "basic",
					"from": {
						"key_code": "non_us_backslash",
						"modifiers": {
							"mandatory": [
								"fn"
							],
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "non_us_backslash"
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "non_us_backslash",
						"modifiers": {
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde"
						}
					]
				}
			]
		},
		{
			"description": "💻 Built in Keyboard: ` ⇨ ⇧ Right Shift or ` when alone",
			"manipulators": [
				{
					"conditions": [
						{
							"type": "device_if",
							"identifiers": [
								{
									"vendor_id": 1452,
									"product_id": 641
								}
							]
						}
					],
					"type": "basic",
					"from": {
						"key_code": "grave_accent_and_tilde",
						"modifiers": {
							"optional": [
								"any"
							]
						}
					},
					"to": [
						{
							"key_code": "right_shift",
							"lazy": true
						}
					],
					"to_if_alone": [
						{
							"key_code": "grave_accent_and_tilde"
						}
					]
				}
			]
		}
	]
}
Finally ditched the rule I was on about to extend ISO Return over the \ key. My fingers just don't need it now.

And the new Mouse mode:

Code: Select all

{
	"title": "🖱 Mouse Keys",
	"rules": [
		{
	    	"description": "🖱 Right ⇧ Shift double tap ⇨ Mouse keys layer lock",
	    	"manipulators": [
				{
					"type": "basic",
					"from": {
						"key_code": "right_shift",
						"modifiers": {
							"optional": [
								"caps_lock"
							]
						}
					},
					"to_if_held_down": [
						{
							"set_variable": {
								"name": "mouse_keys_mode",
								"value": 1
							}
						},
						{
							"key_code": "right_shift"
						}
					],
					"parameters": {
						"basic.to_if_held_down_threshold_milliseconds": 250
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "right_shift pressed",
							"value": 1
						},
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 0
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "right_shift",
						"modifiers": {
							"optional": [
								"caps_lock"
							]
						}
					},
					"to": [
						{
							"set_variable": {
								"name": "mouse_keys_mode",
								"value": 0
							}
						},
						{
							"key_code": "right_shift"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "right_shift pressed",
							"value": 1
						},
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "right_shift",
						"modifiers": {
							"optional": [
								"caps_lock"
							]
						}
					},
					"to": [
						{
							"set_variable": {
								"name": "right_shift pressed",
								"value": 1
							}
						},
						{
							"key_code": "right_shift"
						}
					],
					"to_delayed_action": {
						"to_if_invoked": [
							{
								"set_variable": {
									"name": "right_shift pressed",
									"value": 0
								}
							}
						],
						"to_if_canceled": [
							{
								"set_variable": {
									"name": "right_shift pressed",
									"value": 0
								}
							}
						]
					}
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "semicolon"
					},
					"to": [
						{
							"mouse_key": {
								"x": -1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "quote"
					},
					"to": [
						{
							"mouse_key": {
								"x": 1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "open_bracket"
					},
					"to": [
						{
							"mouse_key": {
								"y": -1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "slash"
					},
					"to": [
						{
							"mouse_key": {
								"y": 1536
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "l"
					},
					"to": [
						{
							"mouse_key": {
								"vertical_wheel": -32
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "period"
					},
					"to": [
						{
							"mouse_key": {
								"vertical_wheel": 32
							}
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "p"
					},
					"to": [
						{
							"pointing_button": "button1"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "close_bracket"
					},
					"to": [
						{
							"pointing_button": "button2"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				},
	    		{
					"type": "basic",
					"from": {
						"key_code": "spacebar"
					},
					"to": [
						{
							"pointing_button": "button1"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "mouse_keys_mode",
							"value": 1
						}
					]
				}
			]
		}
	]
}
This mode is toggled on/off with a double press of Right Shift. I added a to_if_held_down timer of a quarter second to screen out accidental presses when I occasionally hover over the Shift keys while changing my mind, mid-typing something. So far so good in practice!

And finally the Numpad again:

Code: Select all

{
	"title": "🔢 Numpad Layer",
	"rules":
	[
		{
			"description": "🔢 Hold Fn + I square keys ⇨ Numpad",
			"manipulators": [
				{
				"type": "basic",
					"from": {
						"key_code": "j",
						"modifiers": {
							"mandatory": ["fn"]
						}
					},
					"to": [
					{
						"key_code": "keypad_1"
					}
					]
				},
				{
				"type": "basic",
					"from": {
						"key_code": "k",
						"modifiers": {
							"mandatory": ["fn"]
						}
					},
					"to": [
						{
							"key_code": "keypad_2"
						}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "l",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_3"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "u",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_4"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "i",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_5"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "o",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_6"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "7",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_7"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "8",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_8"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "9",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_9"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "0",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_0"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "m",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_0"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "comma",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_0"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "period",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_period"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "hyphen",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_hyphen"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "equal_sign",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_plus"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "slash",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_slash"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "semicolon",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_asterisk"
					}
					]
				},
				{
				"type": "basic",
					"from": {
					"key_code": "return_or_enter",
					"modifiers": {
						"mandatory": [
							"fn"
						]
					}
					},
					"to": [
					{
						"key_code": "keypad_enter"
					}
					]
				}
			]
		},
		{
			"description": "🔢 Insert or ⌥ Option + Option ⇨ Toggle Numpad Layer",
			"manipulators": [
				{
					"from": {
						"key_code": "insert",
						"modifiers": {
							"optional": ["any"]
							}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 1
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 0
						}
					]
				},
				{
					"from": {
						"key_code": "insert",
						"modifiers": {
							"optional": ["any"]
						}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 0
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"from": {
						"key_code": "right_option",
						"modifiers": {
							"mandatory": ["left_option"]
						}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 1
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 0
						}
					]
				},
				{
					"from": {
						"key_code": "right_option",
						"modifiers": {
							"mandatory": ["left_option"]
						}
					},
					"type": "basic",
					"to": {
						"set_variable": {
							"name": "numeric_keypad_mode",
							"value": 0
						}
					},
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "j"
					},
					"to": [
						{
							"key_code": "keypad_1"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "k"
					},
					"to": [
						{
							"key_code": "keypad_2"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "l"
					},
					"to": [
						{
							"key_code": "keypad_3"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "u"
					},
					"to": [
						{
							"key_code": "keypad_4"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "i"
					},
					"to": [
						{
							"key_code": "keypad_5"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "o"
					},
					"to": [
						{
							"key_code": "keypad_6"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "7"
					},
					"to": [
						{
							"key_code": "keypad_7"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "8"
					},
					"to": [
						{
							"key_code": "keypad_8"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "9"
					},
					"to": [
						{
							"key_code": "keypad_9"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "0"
					},
					"to": [
						{
							"key_code": "keypad_0"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "m"
					},
					"to": [
						{
							"key_code": "keypad_0"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "comma"
					},
					"to": [
						{
							"key_code": "keypad_0"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "period"
					},
					"to": [
						{
							"key_code": "keypad_period"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "hyphen"
					},
					"to": [
						{
							"key_code": "keypad_hyphen"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "equal_sign"
					},
					"to": [
						{
							"key_code": "keypad_plus"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "slash"
					},
					"to": [
						{
							"key_code": "keypad_slash"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "semicolon"
					},
					"to": [
						{
							"key_code": "keypad_asterisk"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				},
				{
					"type": "basic",
					"from": {
						"key_code": "return_or_enter"
					},
					"to": [
						{
							"key_code": "keypad_enter"
						}
					],
					"conditions": [
						{
							"type": "variable_if",
							"name": "numeric_keypad_mode",
							"value": 1
						}
					]
				}
			]
		}
	]
}
All that's new a return to simple Option + Option layer toggle command. Much easier, to type than the whole double set of mods I was asking before, and doesn't seem to be accidentally engaging for me now. Will see if it lasts! :lol:

At some point, I want to do magicks like implement keyboard macros like Select Word and Wrap tags, right here in Karabiner. I've asked if Macro support is on the cards, but I'm guessing it's beyond Karabiner's scope. Yes, there's separate apps for stuff like that on the Mac, but I wanna do it all with strictly the keyboard!

User avatar
Muirium
µ

10 May 2021, 17:28

Getting busy now…

Screenshot 2021-05-10 at 4.27.41 pm.jpg
Screenshot 2021-05-10 at 4.27.41 pm.jpg (189.67 KiB) Viewed 146091 times

User avatar
Muirium
µ

09 Sep 2021, 14:10

Hey folks. Yes, I'm still alive. (More or less.) And I just figured out how to do Soarer-style macros in Karabiner!

You can indeed simply stack up whole sequences of output events in Karabiner. Dunno why my earlier attempts at this failed. Just needed to come back to it after a while…

Have at 'em!

Code: Select all

{
	"title": "🦾 General Macros",
	"rules": [
		{
			"description": "🤖 Select Current Word: ⌃ Control + ⌥ Option + ← Left or → Right ⇨ Select Word",
			"manipulators": [
				{
					"from": {
						"key_code": "left_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "left_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "right_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "right_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "right_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "left_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🤖 Select Current Para: ⌃ Control + ⌥ Option + ↑ Up or ↓ Down ⇨ Select Paragraph",
			"manipulators": [
				{
					"from": {
						"key_code": "up_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
					    {
							"key_code": "up_arrow"
						},
						{
							"key_code": "up_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "down_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "down_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "down_arrow"
						},
						{
							"key_code": "down_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "up_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🤖 Wrap Selection: ⌃ Control + ⌥ Option + '\"(*!? ⇨ Paired Bracket Wraps",
			"manipulators": [
				{
					"from": {
						"key_code": "open_bracket",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "close_bracket"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "open_bracket",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "open_bracket",
						     "modifiers": ["left_shift"]
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "close_bracket",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "quote",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "quote"
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "quote"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "quote",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "quote",
						     "modifiers": ["left_shift"]
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "quote",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "9",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "9",
						     "modifiers": ["left_shift"]
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "0",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "1",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "1",
						     "modifiers": ["left_option"]
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "1",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "slash",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "slash",
						     "modifiers": ["left_shift", "left_option"]
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "slash",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "8",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "slash"
						},
						{
						    "key_code": "8",
						    "modifiers": ["left_shift"]
						},
						{
						    "key_code": "spacebar"
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "spacebar"
						},
						{
						    "key_code": "8",
						    "modifiers": ["left_shift"]
						},
						{
						    "key_code": "slash"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "g",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "i"
						},
						{
						    "key_code": "m"
						},
						{
						    "key_code": "g"
						},
						{
						    "key_code": "close_bracket"
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "slash"
						},
						{
						    "key_code": "i"
						},
						{
						    "key_code": "m"
						},
						{
						    "key_code": "g"
						},
						{
						    "key_code": "close_bracket"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "k",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
						    "key_code": "x",
						    "modifiers": ["left_command"]
						},
						{
						    "shell_command": "pbpaste | pbcopy -pboard ruler"
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "u"
						},
						{
						    "key_code": "r"
						},
						{
						    "key_code": "l"
						},
						{
						    "key_code": "equal_sign"
						},
						{
						    "key_code": "close_bracket"
						},
						{
						    "shell_command": "pbpaste -pboard ruler"
						},
						{
						    "key_code": "v",
						    "modifiers": ["left_command"]
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "slash"
						},
						{
						    "key_code": "u"
						},
						{
						    "key_code": "r"
						},
						{
						    "key_code": "l"
						},
						{
						    "key_code": "close_bracket"
						}
					],
					"type": "basic"
				}
			]
		}
    ]
}
I'm particularly fond of the word and para selectors and, of course, 'the' "wraps". Macros like these really speed up writing when you know they're there and you can rely on them. Well chuffed! Especially now that I can rely on them with EVERY keyboard I use! 😄

(The pbcopy/pbpaste malarkey in there is to try to preserve clipboard state—read about it here—the macros still work without that; just trying to keep things clean. Speaking of which, I've hardly any "description": lines in there because I've a ton of rules now and think of them in groups instead of individually, in the GUI. Could really use a comment feature in these JSON files, but haven't worked out how to do it. Tried "comment": and Karabiner refused to play along.)

Edit: Said pbcopy/pbpaste is in fact bass ackwards, too. :roll: Anyway, Control K and Y (secondary paste) are working better instead. So here's the updated macros:

Code: Select all

{
	"title": "🦾 General Macros",
	"rules": [
		{
			"description": "🤖 Select Current Word: ⌃ Control + ⌥ Option + ← Left or → Right ⇨ Select Word",
			"manipulators": [
				{
					"from": {
						"key_code": "left_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "left_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "right_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "right_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "right_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "left_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🤖 Select Current Para: ⌃ Control + ⌥ Option + ↑ Up or ↓ Down ⇨ Select Paragraph",
			"manipulators": [
				{
					"from": {
						"key_code": "up_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
					    {
							"key_code": "up_arrow"
						},
						{
							"key_code": "up_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "down_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "down_arrow",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "down_arrow"
						},
						{
							"key_code": "down_arrow",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "up_arrow",
						    "modifiers": ["left_option", "left_shift"]
						}
					],
					"type": "basic"
				}
			]
		},
		{
			"description": "🤖 Wrap Selection: ⌃ Control + ⌥ Option + '\"([{<8*!? ⇨ Paired Bracket Wraps",
			"manipulators": [
				{
					"from": {
						"key_code": "open_bracket",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "open_bracket"
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "close_bracket"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "open_bracket",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "open_bracket",
						     "modifiers": ["left_shift"]
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "close_bracket",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "quote",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "quote"
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "quote"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "quote",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "quote",
						     "modifiers": ["left_shift"]
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "quote",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "9",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "9",
						     "modifiers": ["left_shift"]
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "0",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "1",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "1",
						     "modifiers": ["left_option"]
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "1",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "slash",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "slash",
						     "modifiers": ["left_shift", "left_option"]
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "slash",
						     "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "8",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "8",
						    "modifiers": ["left_shift"]
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "8",
						    "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "comma",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "comma",
						    "modifiers": ["left_shift"]
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "period",
						    "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "8",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},						{
						    "key_code": "slash"
						},
						{
						    "key_code": "8",
						    "modifiers": ["left_shift"]
						},
						{
						    "key_code": "spacebar"
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "spacebar"
						},
						{
						    "key_code": "8",
						    "modifiers": ["left_shift"]
						},
						{
						    "key_code": "slash"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "g",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "i"
						},
						{
						    "key_code": "m"
						},
						{
						    "key_code": "g"
						},
						{
						    "key_code": "close_bracket"
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "slash"
						},
						{
						    "key_code": "i"
						},
						{
						    "key_code": "m"
						},
						{
						    "key_code": "g"
						},
						{
						    "key_code": "close_bracket"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "k",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
                        {
							"key_code": "k",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "u"
						},
						{
						    "key_code": "r"
						},
						{
						    "key_code": "l"
						},
						{
						    "key_code": "equal_sign"
						},
						{
						    "key_code": "close_bracket"
						},
						{
							"key_code": "y",
							"modifiers": ["left_control"	]
						},
						{
						    "key_code": "open_bracket"
						},
						{
						    "key_code": "slash"
						},
						{
						    "key_code": "u"
						},
						{
						    "key_code": "r"
						},
						{
						    "key_code": "l"
						},
						{
						    "key_code": "close_bracket"
						}
					],
					"type": "basic"
				}
			]
		}
    ]
}
Last edited by Muirium on 09 Sep 2021, 17:26, edited 1 time in total.

User avatar
Muirium
µ

09 Sep 2021, 14:29

Another set of macros enabled by all this: gràvè àccènts àhòy!

Code: Select all

{
	"title": "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Gaelic Macros",
	"rules": [
		{
			"description": "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Gaelic Stràc Macros: 🦾 ⌃ Control + ⌥ Option + aeiou ⇨ àèìòù",
			"manipulators": [
				{
					"from": {
						"key_code": "a",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "a"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "a",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "a",
						    "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "e",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "e"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "e",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "e",
						    "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "i",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "i"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "i",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "i",
						    "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "o",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "o"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "o",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "o",
						    "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "u",
						"modifiers": {
							"mandatory": [
								"option",
								"control"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "u"
						}
					],
					"type": "basic"
				},
				{
					"from": {
						"key_code": "u",
						"modifiers": {
							"mandatory": [
								"option",
								"control",
								"shift"
							]
						}
					},
					"to": [
						{
							"key_code": "grave_accent_and_tilde",
							"modifiers": ["left_option"]
						},
						{
						    "key_code": "u",
						    "modifiers": ["left_shift"]
						}
					],
					"type": "basic"
				}
			]
		}
	]
}
Previously, I could only do these on Soarer or Xwhatsit equipped keyboards. I never could get to grips with coding macros on TMK, so my HHKB was out of luck. Noo! Well, nò wòrrìès àny mòrè! Àll my bòàrds nòw hàvè stràc sùpèrpòwèrs! So much quicker for typing in Gàidhlig, which does have mhòr use for them than English…

Note: 5 vowels but 10 macros. That's because you have to intercept the Shift key, or the macro's inner dead-key twiddling doesn't work. Separate macros for capital and lowercase does the trick.

Just a peek down the rabbit-hole:
Screenshot 2021-09-09 at 1.34.48 pm.jpg
Screenshot 2021-09-09 at 1.34.48 pm.jpg (238.68 KiB) Viewed 144734 times
I'll regroup them properly sometime…

User avatar
Muirium
µ

11 Oct 2021, 12:33

So… Karabiner can press sequences of keys. What happens if you throw Command + C and Command + V into the mix? Well, you have the clipboard, of course. And with shell scripts, you can modify that on the fly. That's what pbcopy and pbpaste are for. Just take a looksie what I gone cooked up! :D

This one gives me the power of sed right at a keystroke: specifically to put-a-bunch-of-hyphens-in-words-like-this.

Code: Select all

{
  "description": "🤖 Hyphenate: ⌃ Control + ⌥ Option + Hyphen ⇨ Replace Spaces with Hyphens",
  "manipulators": [
    {
      "from": {
        "key_code": "hyphen",
        "modifiers": {
          "mandatory": [
            "option",
            "control"
          ]
        }
      },
      "to": [
        {
          "key_code": "c",
          "modifiers": [
            "left_command"
          ],
          "hold_down_milliseconds": 200
        },
        {
          "shell_command": "pbpaste | sed 's/ /-/g' | pbcopy"
        },
        {
          "key_code": "left_command",
          "hold_down_milliseconds": 200
        },
        {
          "key_code": "v",
          "modifiers": [
            "left_command"
          ]
        }
      ],
      "type": "basic"
    }
  ]
}
The wee delays are necessary because Karabiner types so fast, it races ahead of the system clipboard! A 200ms delay does the trick to keep things in sync, and doesn't slow me down.

This one uses tr to do some basic UPPERCASE and lowercase conversion, and a Perl script for Title Case with its many fancy rules:

Code: Select all

{
  "description": "🤖 Character Case: ⌃ Control + ⌥ Option + CLT ⇨ CAPS lower Title Case",
  "manipulators": [
    {
      "from": {
        "key_code": "c",
        "modifiers": {
          "mandatory": [
            "option",
            "control"
          ]
        }
      },
      "to": [
        {
          "key_code": "c",
          "modifiers": [
            "left_command"
          ],
          "hold_down_milliseconds": 200
        },
        {
          "shell_command": "pbpaste | tr '[:lower:]' '[:upper:]' | pbcopy"
        },
        {
          "key_code": "left_command",
          "hold_down_milliseconds": 200
        },
        {
          "key_code": "v",
          "modifiers": [
            "left_command"
          ]
        }
      ],
      "type": "basic"
    },
    {
      "from": {
        "key_code": "l",
        "modifiers": {
          "mandatory": [
            "option",
            "control"
          ]
        }
      },
      "to": [
        {
          "key_code": "c",
          "modifiers": [
            "left_command"
          ],
          "hold_down_milliseconds": 200
        },
        {
          "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | pbcopy"
        },
        {
          "key_code": "left_command",
          "hold_down_milliseconds": 200
        },
        {
          "key_code": "v",
          "modifiers": [
            "left_command"
          ]
        }
      ],
      "type": "basic"
    },
    {
      "from": {
        "key_code": "t",
        "modifiers": {
          "mandatory": [
            "option",
            "control"
          ]
        }
      },
      "to": [
        {
          "key_code": "c",
          "modifiers": [
            "left_command"
          ],
          "hold_down_milliseconds": 200
        },
        {
          "shell_command": "pbpaste | perl ~/.config/karabiner/assets/complex_modifications/TitleCase.pl | pbcopy"
        },
        {
          "key_code": "left_command",
          "hold_down_milliseconds": 200
        },
        {
          "key_code": "v",
          "modifiers": [
            "left_command"
          ]
        }
      ],
      "type": "basic"
    }
  ]
}
I'm still to get that Perl script to play well with non-ascii characters like smart quotes and em dashes, though. (It "escapes" them, which I don't want.) So if anyone knows how to fix that, I'm all ears! It may even be a bug in Karabiner for all I know, as I get different results running the same script directly in the terminal. Yet the simple tr ones handle Unicode text selections in Karabiner just fine.
Last edited by Muirium on 01 Dec 2021, 14:27, edited 2 times in total.

User avatar
Muirium
µ

01 Dec 2021, 14:19

Just a little keyboard customisation going on here, honest. :D

Karabiner Kray-kray.jpg
Karabiner Kray-kray.jpg (153.27 KiB) Viewed 143776 times
Here's my main config, indented with spaces instead of tabs so it's easier on the eyes in that wee box:

Code: Select all

{
  "title": "General Complex Rules",
  "rules": [
    {
      "description": "⌃ Caps Lock ⇨ Right ⌃ Control",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": {
            "key_code": "right_control"
          }
        }
      ]
    },
    {
      "description": "⇪ Combo Caps Lock: ⇧ Shift + ⇧ Shift ⇨ ⇪ Caps Lock",
      "manipulators": [
        {
          "from": {
            "key_code": "left_shift",
            "modifiers": {
              "mandatory": [
                "right_shift"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "mandatory": [
                "left_shift"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌦ Forward Delete: ⇧ Shift + ⌫ Backspace ⇨ ⌦ Delete",
      "manipulators": [
        {
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.finder"
              ]
            }
          ],
          "from": {
            "key_code": "delete_or_backspace",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "option"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_forward"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "type": "frontmost_application_unless",
              "bundle_identifiers": [
                "com.apple.finder",
                "com.pixelmatorteam.pixelmator.x"
              ]
            }
          ],
          "from": {
            "key_code": "delete_or_backspace",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_forward"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌥ Enter: Right ⌥ Option alone ⇨ ⌤ Numpad Enter",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_if_alone_timeout_milliseconds": 100
          },
          "from": {
            "key_code": "right_option"
          },
          "to": [
            {
              "key_code": "right_option"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "keypad_enter",
              "repeat": true
            }
          ]
        }
      ]
    },
    {
      "description": "🗣 Hold Right ⌥ Option + ⌘ Command ⇨ 🗣 Speak Text",
      "manipulators": [
        {
          "from": {
            "key_code": "right_option",
            "modifiers": {
              "mandatory": [
                "right_command"
              ]
            }
          },
          "to_if_held_down": [
            {
              "key_code": "s",
              "modifiers": [
                "right_command",
                "right_control"
              ],
              "repeat": true
            }
          ],
          "parameters": {
            "basic.to_if_held_down_threshold_milliseconds": 1000
          },
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔍 Spotlight: Either ⌘ Command double tap ⇨ 🔍 Spotlight",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 400
          },
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_keyboard_key_code": "spotlight"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "left_command pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 400
          },
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "left_command pressed",
                "value": 1
              }
            },
            {
              "key_code": "left_command"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "left_command pressed",
                  "value": 0
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "left_command pressed",
                  "value": 0
                }
              }
            ]
          }
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_keyboard_key_code": "spotlight"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "right_command pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "right_command pressed",
                "value": 1
              }
            },
            {
              "key_code": "right_command"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "right_command pressed",
                  "value": 0
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "right_command pressed",
                  "value": 0
                }
              }
            ]
          }
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔅 ⇨ Displays Preferences Pane",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Displays.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Displays.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔆 ⇨ Keyboard Preferences Pane",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Keyboard.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Keyboard.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔍 ⇨ Spotlight Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f4",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Spotlight.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🎙 ⇨ Sound Preferences Pane",
      "manipulators": [
        {
          "from": {
            "consumer_key_code": "dictation",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Sound.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f5",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Sound.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ☾ ⇨ Accessibility Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f6",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/UniversalAccessPref.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏪ ⇨ Time Machine Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "rewind",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/TimeMachine.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f7",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/TimeMachine.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏯ ⇨ Bluetooth Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "play_or_pause",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Bluetooth.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f8",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Bluetooth.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏩ ⇨ Software Update Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "fast_forward",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/SoftwareUpdate.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f9",
            "modifiers": {
              "mandatory": [
                "option"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/SoftwareUpdate.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "🔊 Navigation Sixpack lock row ⇨ 🔉 Volume keys",
      "manipulators": [
        {
          "from": {
            "key_code": "print_screen",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "mute",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "keypad_num_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "mute",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "scroll_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "pause",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔉 Fine Volume: ⌘ Command ± 🔉 ⇨ Shift + Option ± 🔉",
      "manipulators": [
        {
          "from": {
            "key_code": "volume_decrement",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f11",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "volume_increment",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f12",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔅 Fine Brightness: ⌘ Command ± 🔅 ⇨ Shift + Option ± 🔅",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🌟 Contrast: ⌃ Control ± 🔅 ⇨ Control + Option + Command ± .",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "period",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "period",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "comma",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "comma",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🌙 Darkside: ^ Control + ⌥ Option + ⌘ Command + 9 ⇨ Toggle Dark Mode",
      "manipulators": [
        {
          "from": {
            "key_code": "9",
            "modifiers": {
              "mandatory": [
                "control",
                "option",
                "command"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /Users/john/.config/karabiner/assets/complex_modifications/Darkside.app"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "✨ Keyboard Brightness: ⌘ Command + ⌥ Option ± 🔅 ⇨ Illumination Up / Down",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_down",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_down",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_up",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_up",
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "️🔋 Fn + ⎋ Esc ⇨ ⚡ Power",
      "manipulators": [
        {
          "from": {
            "key_code": "escape",
            "modifiers": {
              "mandatory": [
                "fn"
              ]
            }
          },
          "to": [
            {
              "software_function": {
                "iokit_power_management_sleep_system": {
                  "delay_milliseconds": 500
                }
              }
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔒 Quit Safety Lock: Hold ⌘ Command + Q to Quit Finder or Safari",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_if_alone_timeout_milliseconds": 1000,
            "basic.to_if_held_down_threshold_milliseconds": 1000
          },
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.finder",
                "com.apple.Safari"
              ]
            }
          ],
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to_if_held_down": [
            {
              "key_code": "q",
              "modifiers": [
                "command"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "💬 Fix Messages: ⇧ Shift + ⌘ Command + [ ⇨ Previous Tab",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.MobileSMS"
              ]
            }
          ],
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "command",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "tab",
              "modifiers": [
                "shift",
                "control"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "⏯ Play Lock: F8 ⇨ Play/Pause only in specified apps",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Music",
                "com.apple.QuickTimePlayerX",
                "com.apple.podcasts",
                "com.colliderli.iina",
                "org.videolan.vlc",
                "fm.overcast.overcast"
              ]
            }
          ],
          "from": {
            "key_code": "f8",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "play_or_pause"
            }
          ]
        }
      ]
    },
    {
      "description": "⌃ Control D/F ⇨ Move Cursor One Word Left/Right",
      "manipulators": [
        {
          "from": {
            "key_code": "d",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌃ Control S/G ⇨ Move Cursor to Home/End",
      "manipulators": [
        {
          "from": {
            "key_code": "s",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "a",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "g",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "e",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Select Current Word: ⌃ Control + C/V ⇨ Select Word Left/Right",
      "manipulators": [
        {
          "from": {
            "key_code": "c",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "v",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Select Current Para: ⌃ Control + X/B ⇨ Select Para Last/Next",
      "manipulators": [
        {
          "from": {
            "key_code": "x",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "up_arrow"
            },
            {
              "key_code": "up_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "down_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "b",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "down_arrow"
            },
            {
              "key_code": "down_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "up_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Wrap Selection: ⌃ Control + '\"([{<*!? ⇨ Paired Bracket Wraps",
      "manipulators": [
        {
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "open_bracket"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "close_bracket",
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "open_bracket",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "close_bracket",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "9",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "9",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "0",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "1",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "1",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "1",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "slash",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash",
              "modifiers": [
                "left_shift",
                "left_option"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "8",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "comma",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "comma",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "period",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "8",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash"
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "spacebar"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "spacebar"
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "slash"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Hyphenate: ⌃ Control + Hyphen ⇨ Replace-Spaces-with-Hyphens_or_Underscores",
      "manipulators": [
        {
          "from": {
            "key_code": "hyphen",
            "modifiers": {
              "mandatory": [
                "shift",
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | sed $'s/ /_/g' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "hyphen",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | sed 's/ /-/g' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Character Case: ⌃ Control + ⇧LWQ ⇨ UPPER lower Word Title Case",
      "manipulators": [
        {
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:lower:]' '[:upper:]' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "w",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "w",
              "modifiers": [
                "left_command",
                "left_option",
                "left_control"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | perl ~/.config/karabiner/assets/complex_modifications/TitleCase.pl | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    }
  ]
}
I recently gave my bèlòvèd gràvè àccènts the straight Control + vowel shortcuts they deserve. Here's their config:

Code: Select all

{
  "title": "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Gaelic Macros",
  "rules": [
    {
      "description": "🏴󠁧󠁢󠁳󠁣󠁴󠁿 Gaelic Stràc Macros: ⌃ Control + aeiou ⇨ àèìòù",
      "manipulators": [
        {
          "from": {
            "key_code": "a",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "a"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "a",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "a",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "e",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "e"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "e",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "e",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "i",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "i"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "i",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "i",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "o",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "o"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "o",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "o",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "u",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "u"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "u",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "grave_accent_and_tilde",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "u",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    }
  ]
}
That left me needing to move the very useful Control A and E shortcuts elsewhere, for home and end in parapgraphs. Note: not to be confused with regular Home and End, which work differently on the Mac in a way I also like. Control A and E are just like they are on Windows: line home and line end, while on the Mac those keys are document home and document end. So I've now got both!

What I've done is make a rectangle of keys for text navigation and selection control. Trying it out now.

SDFG are Home, move left one word, more right one word, and End.
XCVB are select previous para, select left word, select right word, and select next para.

So far, so good. I like having all this twiddly macro goodness, single handed on my HHKB!

I've also moved some of my scripts from FastScripts into Karabiner now, saving me another whole application. Darkside is a compiled AppleScript for toggling between Dark and Light mode in macOS with a single keystroke. Here's its code:

Code: Select all

--Toggle system darkness theme
tell application "System Events"
	tell appearance preferences
		set dark mode to not dark mode
		set darkness to dark mode
	end tell
end tell

--Display a matching notification
if darkness = true then
	display notification "Something something Dark Side!" with title "Darkside"
end if
if darkness = false then
	display notification "Gah! It burns!" with title "Lightside"
end if
Now if I could just figure out how to do a similar trick with Automatic Brightness control in System Preferences. Monterey broke my old script:

Code: Select all

--Check if System Preferences already open?
--Don't want to quit it on exit if it's already running
set appName to "System Preferences"
if application appName is running then
	set appRunning to true
else
	set appRunning to false
end if

--Toggle Automatic Display Brightness
tell application "System Preferences"
	set current pane to pane id "com.apple.preference.displays"
	tell application "System Events"
		tell process "System Preferences"
			tell checkbox "Automatically adjust brightness" of tab group of window 1
				click
				--Display a matching notification
				if value = {0} then
					display notification "Automatic Brightness Disabled: Manual Override" with title "Manual Display Brightness"
				end if
				if value = {1} then
					display notification "Automatic Brightness Enabled: Sensor Engaged" with title "Automatic Display Brightness"
				end if
			end tell
		end tell
	end tell
end tell

--Quit System Preferences if this script opened it up
if appRunning = false then
	tell application "System Preferences" to quit
end if
Anyone any ideas? That was one very handy key-combo in cloudy Scotland where dimming screens get daft ideas of their own!

User avatar
Muirium
µ

08 Dec 2021, 19:28

Still tweaking. This time I managed to remove a dependency on a system service (WordService) I habitually install, but is not present by default. So Now I Can Word Capitalise Strings With A Single Press Of Control + W Using Karabiner Alone, No Other Software Required, Anywhere At All On The Mac. Surprisingly useful, these text handling shortcuts I've been cooking. :geek:

My Fancier TitleCase, Which Produces Output Like This Sentence, Still Relies on a Local Copy of John Gruber's TitleCase Perl Script. If I could figure out all that logic in a one liner, I'd be tempted to integrate it, too.

Actually, I found a routine use case where title casing needs tweaked, so I've also added that. MIstyped initial capitals! I found I often (but not always) needed to lowercase the selected text then run (either) title case on it, which is awkward as text selection is not maintained. So I just piped the lowercase function into each of those scripts, and threw the secondary version onto Shift + Control + Q or W instead. That way I know to press Shift when calling it any time I need the alternate behaviour. Works much better in practice when I'm just about to hit Undo! :lol:

New core config:

Code: Select all

{
  "title": "General Complex Rules",
  "rules": [
    {
      "description": "⌃ Caps Lock ⇨ Right ⌃ Control",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": {
            "key_code": "right_control"
          }
        }
      ]
    },
    {
      "description": "⇪ Combo Caps Lock: ⇧ Shift + ⇧ Shift ⇨ ⇪ Caps Lock",
      "manipulators": [
        {
          "from": {
            "key_code": "left_shift",
            "modifiers": {
              "mandatory": [
                "right_shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "mandatory": [
                "left_shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌦ Forward Delete: ⇧ Shift + ⌫ Backspace ⇨ ⌦ Delete",
      "manipulators": [
        {
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.finder"
              ]
            }
          ],
          "from": {
            "key_code": "delete_or_backspace",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "option",
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_forward"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "type": "frontmost_application_unless",
              "bundle_identifiers": [
                "com.apple.finder",
                "com.pixelmatorteam.pixelmator.x"
              ]
            }
          ],
          "from": {
            "key_code": "delete_or_backspace",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_forward"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌥ Enter: Right ⌥ Option alone ⇨ ⌤ Numpad Enter",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_if_alone_timeout_milliseconds": 100
          },
          "from": {
            "key_code": "right_option"
          },
          "to": [
            {
              "key_code": "right_option"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "keypad_enter",
              "repeat": true
            }
          ]
        }
      ]
    },
    {
      "description": "🗣 Hold Right ⌥ Option + ⌘ Command ⇨ 🗣 Speak Text",
      "manipulators": [
        {
          "from": {
            "key_code": "right_option",
            "modifiers": {
              "mandatory": [
                "right_command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to_if_held_down": [
            {
              "key_code": "s",
              "modifiers": [
                "right_command",
                "right_control"
              ],
              "repeat": true
            }
          ],
          "parameters": {
            "basic.to_if_held_down_threshold_milliseconds": 1000
          },
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔍 Spotlight: Either ⌘ Command double tap ⇨ 🔍 Spotlight",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 400
          },
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_keyboard_key_code": "spotlight"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "left_command pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 400
          },
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "left_command pressed",
                "value": 1
              }
            },
            {
              "key_code": "left_command"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "left_command pressed",
                  "value": 0
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "left_command pressed",
                  "value": 0
                }
              }
            ]
          }
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_keyboard_key_code": "spotlight"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "right_command pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "right_command pressed",
                "value": 1
              }
            },
            {
              "key_code": "right_command"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "right_command pressed",
                  "value": 0
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "right_command pressed",
                  "value": 0
                }
              }
            ]
          }
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔅 ⇨ Displays Preferences Pane",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Displays.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Displays.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔆 ⇨ Keyboard Preferences Pane",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Keyboard.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Keyboard.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔍 ⇨ Spotlight Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f4",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Spotlight.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🎙 ⇨ Sound Preferences Pane",
      "manipulators": [
        {
          "from": {
            "consumer_key_code": "dictation",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Sound.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f5",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Sound.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ☾ ⇨ Accessibility Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f6",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/UniversalAccessPref.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏪ ⇨ Time Machine Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "rewind",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/TimeMachine.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f7",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/TimeMachine.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏯ ⇨ Bluetooth Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "play_or_pause",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Bluetooth.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f8",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Bluetooth.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏩ ⇨ Software Update Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "fast_forward",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/SoftwareUpdate.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f9",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/SoftwareUpdate.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "🔊 Navigation Sixpack lock row ⇨ 🔉 Volume keys",
      "manipulators": [
        {
          "from": {
            "key_code": "print_screen",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "mute",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "keypad_num_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "mute",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "scroll_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "pause",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔉 Fine Volume: ⌘ Command ± 🔉 ⇨ Shift + Option ± 🔉",
      "manipulators": [
        {
          "from": {
            "key_code": "volume_decrement",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f11",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "volume_increment",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f12",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔅 Fine Brightness: ⌘ Command ± 🔅 ⇨ Shift + Option ± 🔅",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🌟 Contrast: ⌃ Control ± 🔅 ⇨ Control + Option + Command ± .",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "period",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "period",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "comma",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "comma",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🌙 Darkside: ^ Control + ⌥ Option + ⌘ Command + 9 ⇨ Toggle Dark Mode",
      "manipulators": [
        {
          "from": {
            "key_code": "9",
            "modifiers": {
              "mandatory": [
                "control",
                "option",
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open ~/.config/karabiner/assets/complex_modifications/Darkside.app"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "✨ Keyboard Brightness: ⌘ Command + ⌥ Option ± 🔅 ⇨ Illumination Up / Down",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_down",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_down",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_up",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_up",
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "️🔋 Fn + ⎋ Esc ⇨ ⚡ Power",
      "manipulators": [
        {
          "from": {
            "key_code": "escape",
            "modifiers": {
              "mandatory": [
                "fn"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "software_function": {
                "iokit_power_management_sleep_system": {
                  "delay_milliseconds": 500
                }
              }
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔒 Quit Safety Lock: Hold ⌘ Command + Q to Quit Finder or Safari",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_if_alone_timeout_milliseconds": 1000,
            "basic.to_if_held_down_threshold_milliseconds": 1000
          },
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.finder",
                "com.apple.Safari"
              ]
            }
          ],
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to_if_held_down": [
            {
              "key_code": "q",
              "modifiers": [
                "command"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "💬 Fix Messages: ⇧ Shift + ⌘ Command + [ ⇨ Previous Tab",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.MobileSMS"
              ]
            }
          ],
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "command",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "tab",
              "modifiers": [
                "shift",
                "control"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "⏯ Play Lock: F8 ⇨ Play/Pause only in specified apps",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Music",
                "com.apple.QuickTimePlayerX",
                "com.apple.podcasts",
                "com.colliderli.iina",
                "org.videolan.vlc",
                "fm.overcast.overcast"
              ]
            }
          ],
          "from": {
            "key_code": "f8",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "play_or_pause"
            }
          ]
        }
      ]
    },
    {
      "description": "⌃ Control D/F ⇨ Move Cursor One Word Left/Right",
      "manipulators": [
        {
          "from": {
            "key_code": "d",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌃ Control S/G ⇨ Move Cursor to Home/End",
      "manipulators": [
        {
          "from": {
            "key_code": "s",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "a",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "g",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "e",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Select Current Word: ⌃ Control + C/V ⇨ Select Word Left/Right",
      "manipulators": [
        {
          "from": {
            "key_code": "c",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "v",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Select Current Para: ⌃ Control + X/B ⇨ Select Para Last/Next",
      "manipulators": [
        {
          "from": {
            "key_code": "x",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "up_arrow"
            },
            {
              "key_code": "up_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "down_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "b",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "down_arrow"
            },
            {
              "key_code": "down_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "up_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Wrap Selection: ⌃ Control + '\"([{<*!? ⇨ Paired Bracket Wraps",
      "manipulators": [
        {
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "open_bracket"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "close_bracket",
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "open_bracket",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "close_bracket",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "9",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "9",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "0",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "1",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "1",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "1",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "slash",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash",
              "modifiers": [
                "left_shift",
                "left_option"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "8",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "comma",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "comma",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "period",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "slash",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash"
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "spacebar"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "spacebar"
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "slash"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Hyphenate: ⌃ Control + Hyphen ⇨ Replace-Spaces-with-Hyphens_or_Underscores",
      "manipulators": [
        {
          "from": {
            "key_code": "hyphen",
            "modifiers": {
              "mandatory": [
                "shift",
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | sed $'s/ /_/g' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "hyphen",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | sed 's/ /-/g' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Character Case: ⌃ Control + ⇧LWQ ⇨ UPPER lower Word Title Case",
      "manipulators": [
        {
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:lower:]' '[:upper:]' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "w",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | awk '{for(j=1;j<=NF;j++){ $j=toupper(substr($j,1,1)) substr($j,2) }}1' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "w",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | awk '{for(j=1;j<=NF;j++){ $j=toupper(substr($j,1,1)) substr($j,2) }}1' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | perl ~/.config/karabiner/assets/complex_modifications/TitleCase.pl | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | perl ~/.config/karabiner/assets/complex_modifications/TitleCase.pl | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    }
  ]
}
I also finally remembered to add the optional caps_lock modifier where appropriate, a beginniner's mistake I was still making till now. :roll:

User avatar
Muirium
µ

24 Dec 2021, 14:24

Fixed that bloody AppleScript. (Accessibility Inspector revealed what was going on with the Displays pane in System Preferences: Apple invisibly messed around the hierarchy in that window.) Then I got snared up in the delight that is just how exactly to grant yourself permission to let the buggers run! (Lots of rake-face there.) Fixed all that by using the osascript command to run AppleScripts from within Karabiner instead of calling separate binaries. And finally it works! Oy…

Here's said AppleScripts. 🌤 Auto Brightness

Code: Select all

--Check if System Preferences already open?
--Don't want to quit it on exit if it's already running
set appName to "System Preferences"
if application appName is running then
	set appRunning to true
else
	set appRunning to false
end if

--Toggle Automatic Display Brightness
tell application "System Preferences"
	set current pane to pane id "com.apple.preference.displays"
	tell application "System Events"
		tell process "System Preferences"
			tell checkbox "Automatically adjust brightness" of group of window 1
				click
				--Display a matching notification
				if value = {0} then
					display notification "Automatic Brightness Disabled: Manual Override" with title "Manual Display Brightness"
				end if
				if value = {1} then
					display notification "Automatic Brightness Enabled: Sensor Engaged" with title "Automatic Display Brightness"
				end if
			end tell
		end tell
	end tell
end tell

--Quit System Preferences if this script opened it up
if appRunning = false then
	tell application "System Preferences" to quit
end if
This one's fun: 🕯 True Tone. Apple messed up the scripting name for the True Tone button. Copied all that guff out from Accessibility Inspector.

Code: Select all

--Check if System Preferences already open?
--Don't want to quit it on exit if it's already running
set appName to "System Preferences"
if application appName is running then
	set appRunning to true
else
	set appRunning to false
end if

--Toggle Automatic Display Brightness
tell application "System Preferences"
	set current pane to pane id "com.apple.preference.displays"
	tell application "System Events"
		tell process "System Preferences"
			tell checkbox "True Tone, Automatically adapt display to make colours appear consistent in different ambient lighting conditions." of group of window 1
				click
				--Display a matching notification
				if value = {0} then
					display notification "True Tone Disabled: Manual Override" with title "True Tone"
				end if
				if value = {1} then
					display notification "True Tone Enabled: Sensor Engaged" with title "True Tone"
				end if
			end tell
		end tell
	end tell
end tell

--Quit System Preferences if this script opened it up
if appRunning = false then
	tell application "System Preferences" to quit
end if
And join me, on the 🌙 Darkside

Code: Select all

--Toggle system darkness theme
tell application "System Events"
	tell appearance preferences
		set dark mode to not dark mode
		set darkness to dark mode
	end tell
end tell

--Display a matching notification
if darkness = true then
	display notification "Something something Dark Side!" with title "Darkside"
end if
if darkness = false then
	display notification "Gah! It burns!" with title "Lightside"
end if
Finally, here's my updated 🦄 General Complex Rules file with all these buggers worked into it:

Code: Select all

{
  "title": "🦄 General Complex Rules",
  "rules": [
    {
      "description": "⌃ Caps Lock ⇨ Right ⌃ Control",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": {
            "key_code": "right_control"
          }
        }
      ]
    },
    {
      "description": "⇪ Combo Caps Lock: ⇧ Shift + ⇧ Shift ⇨ ⇪ Caps Lock",
      "manipulators": [
        {
          "from": {
            "key_code": "left_shift",
            "modifiers": {
              "mandatory": [
                "right_shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "right_shift",
            "modifiers": {
              "mandatory": [
                "left_shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "caps_lock"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌦ Forward Delete: ⇧ Shift + ⌫ Backspace ⇨ ⌦ Delete",
      "manipulators": [
        {
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.finder"
              ]
            }
          ],
          "from": {
            "key_code": "delete_or_backspace",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "option",
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_forward"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "type": "frontmost_application_unless",
              "bundle_identifiers": [
                "com.apple.finder",
                "com.pixelmatorteam.pixelmator.x"
              ]
            }
          ],
          "from": {
            "key_code": "delete_or_backspace",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_forward"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌥ Enter: Right ⌥ Option alone ⇨ ⌤ Numpad Enter",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_if_alone_timeout_milliseconds": 100
          },
          "from": {
            "key_code": "right_option"
          },
          "to": [
            {
              "key_code": "right_option"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "keypad_enter",
              "repeat": true
            }
          ]
        }
      ]
    },
    {
      "description": "🗣 Hold Right ⌥ Option + ⌘ Command ⇨ 🗣 Speak Text",
      "manipulators": [
        {
          "from": {
            "key_code": "right_option",
            "modifiers": {
              "mandatory": [
                "right_command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to_if_held_down": [
            {
              "key_code": "s",
              "modifiers": [
                "right_command",
                "right_control"
              ],
              "repeat": true
            }
          ],
          "parameters": {
            "basic.to_if_held_down_threshold_milliseconds": 1000
          },
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔍 Spotlight: Either ⌘ Command double tap ⇨ 🔍 Spotlight",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 400
          },
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_keyboard_key_code": "spotlight"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "left_command pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "parameters": {
            "basic.to_delayed_action_delay_milliseconds": 400
          },
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "left_command pressed",
                "value": 1
              }
            },
            {
              "key_code": "left_command"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "left_command pressed",
                  "value": 0
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "left_command pressed",
                  "value": 0
                }
              }
            ]
          }
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_keyboard_key_code": "spotlight"
            }
          ],
          "conditions": [
            {
              "type": "variable_if",
              "name": "right_command pressed",
              "value": 1
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "set_variable": {
                "name": "right_command pressed",
                "value": 1
              }
            },
            {
              "key_code": "right_command"
            }
          ],
          "to_delayed_action": {
            "to_if_invoked": [
              {
                "set_variable": {
                  "name": "right_command pressed",
                  "value": 0
                }
              }
            ],
            "to_if_canceled": [
              {
                "set_variable": {
                  "name": "right_command pressed",
                  "value": 0
                }
              }
            ]
          }
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔅 ⇨ Displays Preferences Pane",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Displays.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Displays.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔆 ⇨ Keyboard Preferences Pane",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Keyboard.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Keyboard.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🔍 ⇨ Spotlight Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f4",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Spotlight.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + 🎙 ⇨ Sound Preferences Pane",
      "manipulators": [
        {
          "from": {
            "consumer_key_code": "dictation",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Sound.prefPane"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f5",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Sound.prefPane"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ☾ ⇨ Accessibility Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f6",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/UniversalAccessPref.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏪ ⇨ Time Machine Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "rewind",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/TimeMachine.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f7",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/TimeMachine.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏯ ⇨ Bluetooth Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "play_or_pause",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Bluetooth.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f8",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/Bluetooth.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "⚙️ Preferences: ⌥ Option + ⏩ ⇨ Software Update Preferences Pane",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "consumer_key_code": "fast_forward",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/SoftwareUpdate.prefPane"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "f9",
            "modifiers": {
              "mandatory": [
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "open /System/Library/PreferencePanes/SoftwareUpdate.prefPane"
            }
          ]
        }
      ]
    },
    {
      "description": "🔊 Navigation Sixpack lock row ⇨ 🔉 Volume keys",
      "manipulators": [
        {
          "from": {
            "key_code": "print_screen",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "mute",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "keypad_num_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "mute",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "scroll_lock",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "pause",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔉 Fine Volume: ⌘ Command ± 🔉 ⇨ Shift + Option ± 🔉",
      "manipulators": [
        {
          "from": {
            "key_code": "volume_decrement",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f11",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "volume_increment",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f12",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "volume_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔅 Fine Brightness: ⌘ Command ± 🔅 ⇨ Shift + Option ± 🔅",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_decrement",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "display_brightness_increment",
              "modifiers": [
                "left_shift",
                "left_alt"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🌟 Contrast: ⌃ Control ± 🔅 ⇨ Control + Option + Command ± .",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "period",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "period",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "comma",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "comma",
              "modifiers": [
                "left_control",
                "left_option",
                "left_command"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🌙 Darkside: ^ Control + ⌥ Option + ⌘ Command + 9 ⇨ Toggle Dark Mode",
      "manipulators": [
        {
          "from": {
            "key_code": "9",
            "modifiers": {
              "mandatory": [
                "control",
                "option",
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "osascript ~/.config/karabiner/assets/complex_modifications/Darkside.scpt"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🌤 Auto Brightness: ^ Control + ⌥ Option + ⌘ Command + 0 ⇨ Toggle Auto Brightness",
      "manipulators": [
        {
          "from": {
            "key_code": "0",
            "modifiers": {
              "mandatory": [
                "control",
                "option",
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "osascript ~/.config/karabiner/assets/complex_modifications/Auto\\ Brightness.scpt"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🕯 True Tone: ^ Control + ⌥ Option + ⌘ Command + - ⇨ Toggle True Tone",
      "manipulators": [
        {
          "from": {
            "key_code": "hyphen",
            "modifiers": {
              "mandatory": [
                "control",
                "option",
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "shell_command": "osascript ~/.config/karabiner/assets/complex_modifications/True\\ Tone.scpt"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "✨ Keyboard Brightness: ⌘ Command + ⌥ Option ± 🔅 ⇨ Illumination Up / Down",
      "manipulators": [
        {
          "from": {
            "key_code": "display_brightness_decrement",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_down",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f1",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_down",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "display_brightness_increment",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_up",
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f2",
            "modifiers": {
              "mandatory": [
                "command",
                "option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "apple_vendor_top_case_key_code": "illumination_up",
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "️🔋 Fn + ⎋ Esc ⇨ ⚡ Power",
      "manipulators": [
        {
          "from": {
            "key_code": "escape",
            "modifiers": {
              "mandatory": [
                "fn"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "software_function": {
                "iokit_power_management_sleep_system": {
                  "delay_milliseconds": 500
                }
              }
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🔒 Quit Safety Lock: Hold ⌘ Command + Q to Quit Finder or Safari",
      "manipulators": [
        {
          "type": "basic",
          "parameters": {
            "basic.to_if_alone_timeout_milliseconds": 1000,
            "basic.to_if_held_down_threshold_milliseconds": 1000
          },
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.finder",
                "com.apple.Safari"
              ]
            }
          ],
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to_if_held_down": [
            {
              "key_code": "q",
              "modifiers": [
                "command"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "️⇥ Option Tabs: Right ⌥ Option + Left/Right ⇨ Cycle Tabs",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Safari",
                "com.apple.finder"
              ]
            }
          ],
          "from": {
            "key_code": "left_arrow",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "tab",
              "modifiers": [
                "shift",
                "control"
              ]
            }
          ]
        },
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Safari",
                "com.apple.finder"
              ]
            }
          ],
          "from": {
            "key_code": "right_arrow",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "tab",
              "modifiers": [
                "control"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "💬 Fix Messages: ⇧ Shift + ⌘ Command + [ ⇨ Previous Tab",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.MobileSMS"
              ]
            }
          ],
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "command",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "tab",
              "modifiers": [
                "shift",
                "control"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "🧭 Safari Navigation: Right ⌘ Command + Arrows ⇨ ⇞ Page and ↖ Home",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Safari"
              ]
            }
          ],
          "from": {
            "key_code": "up_arrow",
            "modifiers": {
              "mandatory": [
                "right_command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "page_up"
            }
          ]
        },
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Safari"
              ]
            }
          ],
          "from": {
            "key_code": "down_arrow",
            "modifiers": {
              "mandatory": [
                "right_command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "page_down"
            }
          ]
        },
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Safari"
              ]
            }
          ],
          "from": {
            "key_code": "left_arrow",
            "modifiers": {
              "mandatory": [
                "right_command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "home"
            }
          ]
        },
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Safari"
              ]
            }
          ],
          "from": {
            "key_code": "right_arrow",
            "modifiers": {
              "mandatory": [
                "right_command"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "end"
            }
          ]
        }
      ]
    },
    {
      "description": "🎨 Pixelmator Chop: Control + Q ⇨ Crop to Inverse Selection",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.pixelmatorteam.pixelmator.x"
              ]
            }
          ],
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "i",
              "modifiers": [
                "left_shift",
                "left_command"
              ]
            },
            {
              "key_code": "c",
              "repeat": false
            },
            {
              "key_code": "return_or_enter",
              "repeat": false
            }
          ]
        }
      ]
    },
    {
      "description": "⏯ Play Lock: F8 ⇨ Play/Pause only in specified apps",
      "manipulators": [
        {
          "type": "basic",
          "conditions": [
            {
              "type": "frontmost_application_if",
              "bundle_identifiers": [
                "com.apple.Music",
                "com.apple.QuickTimePlayerX",
                "com.apple.podcasts",
                "com.colliderli.iina",
                "org.videolan.vlc",
                "fm.overcast.overcast"
              ]
            }
          ],
          "from": {
            "key_code": "f8",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "to": [
            {
              "consumer_key_code": "play_or_pause"
            }
          ]
        }
      ]
    },
    {
      "description": "⌤ Numpad Enter ⇨ Scroll View to Text Cursor",
      "manipulators": [
        {
          "from": {
            "key_code": "keypad_enter",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "l",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "return_or_enter",
            "modifiers": {
              "mandatory": [
                "right_option"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "l",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌃ Control D/F ⇨ Move Cursor One Word Left/Right",
      "manipulators": [
        {
          "from": {
            "key_code": "d",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "f",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "⌃ Control S/G ⇨ Move Cursor to Home/End",
      "manipulators": [
        {
          "from": {
            "key_code": "s",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "a",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "g",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "e",
              "modifiers": [
                "left_control"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Select Current Word: ⌃ Control + C/V ⇨ Select Word Left/Right",
      "manipulators": [
        {
          "from": {
            "key_code": "c",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "c",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "v",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "left_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "v",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock",
                "shift"
              ]
            }
          },
          "to": [
            {
              "key_code": "right_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": true
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Select Current Para: ⌃ Control + X/B ⇨ Select Para Last/Next",
      "manipulators": [
        {
          "from": {
            "key_code": "x",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "up_arrow"
            },
            {
              "key_code": "up_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "down_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "b",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "down_arrow"
            },
            {
              "key_code": "down_arrow",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "up_arrow",
              "modifiers": [
                "left_option",
                "left_shift"
              ],
              "repeat": false
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Wrap Selection: ⌃ Control + '\"([{<*!? ⇨ Paired Bracket Wraps",
      "manipulators": [
        {
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "open_bracket"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "close_bracket",
              "repeat": false
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "open_bracket",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "close_bracket",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote"
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "quote",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "quote",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "9",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "9",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "0",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "1",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "1",
              "modifiers": [
                "left_option"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "1",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "slash",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash",
              "modifiers": [
                "left_shift",
                "left_option"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "8",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "comma",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "comma",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "period",
              "modifiers": [
                "left_shift"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "slash",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "k",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "slash"
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "spacebar"
            },
            {
              "key_code": "y",
              "modifiers": [
                "left_control"
              ]
            },
            {
              "key_code": "spacebar"
            },
            {
              "key_code": "8",
              "modifiers": [
                "left_shift"
              ]
            },
            {
              "key_code": "slash"
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Hyphenate: ⌃ Control + Hyphen ⇨ Replace-Spaces-with-Hyphens_or_Underscores",
      "manipulators": [
        {
          "from": {
            "key_code": "hyphen",
            "modifiers": {
              "mandatory": [
                "shift",
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | sed $'s/ /_/g' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "hyphen",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | sed 's/ /-/g' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    },
    {
      "description": "🦾 Character Case: ⌃ Control + ⇧LWQ ⇨ UPPER lower Word Title Case",
      "manipulators": [
        {
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:lower:]' '[:upper:]' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "l",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "w",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | perl -pe '$_=~s/\b(\\w)/\\U$1/g;' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "from": {
            "key_code": "w",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | perl -pe '$_=~s/\b(\\w)/\\U$1/g;' | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "type": "frontmost_application_unless",
              "bundle_identifiers": [
                "com.pixelmatorteam.pixelmator.x"
              ]
            }
          ],
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "control"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | tr '[:upper:]' '[:lower:]' | perl ~/.config/karabiner/assets/complex_modifications/TitleCase.pl | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "type": "frontmost_application_unless",
              "bundle_identifiers": [
                "com.pixelmatorteam.pixelmator.x"
              ]
            }
          ],
          "from": {
            "key_code": "q",
            "modifiers": {
              "mandatory": [
                "control",
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "c",
              "modifiers": [
                "left_command"
              ],
              "hold_down_milliseconds": 200
            },
            {
              "shell_command": "pbpaste | perl ~/.config/karabiner/assets/complex_modifications/TitleCase.pl | pbcopy"
            },
            {
              "key_code": "left_command",
              "hold_down_milliseconds": 200
            },
            {
              "key_code": "v",
              "modifiers": [
                "left_command"
              ]
            }
          ],
          "type": "basic"
        }
      ]
    }
  ]
}

Post Reply

Return to “Workshop”