I’ve been playing with some Karabiner Elements setups and thought I’d start sharing some that I find useful. I’m publishing these as part of the KeyBinding series, as I think they make sense there.
This first one is a way to make tab switching (⌘+[/]) slightly more convenient. I say slightly, as the modifier key combination for this is really pretty second nature to me, I just wanted to see what it would be like as a simple, single-row key combination.
The configuration makes the backslash key function as right command when held with other keys, meaning the little cluster of []\ can be used without moving your thumb, holding \ with your pinky and using [/] to navigate left and right. If you double tap \ and hold it, it becomes ⇧+⌘, so you can ⇧+⌘+{ instead. In most web browsers, ⌘+[ navigates back in history, and ⇧+⌘+{ switches to the previous tab. So this configuration makes tab switching in any app convenient.
Caveats
Because we have to watch for double taps, there’s now a 250ms delay when just typing a backslash alone. You could shorten this delay if you wanted to experiment with exactly how fast you’d have to double tap to make that work. The slight delay on a lesser used character seems reasonable to me. Maybe after using it for a while I change my mind about that. We’ll see.
You also lose key repeat, so you can’t hold backslash down to type \\\\\\\\. That’s not something I’ll ever need to do, I don’t think.
The other issue I’m running into that I haven’t solved yet, is that if I just hold the backslash key on its own for too long, it sends ⌘+\, which for me triggers 1Password Autofill1. I’d rather not have that happen as it means if I simply take too long to hit one of the brackets, I get interrupted by the popup. Maybe that would be a cool trick if it were intentional, but ‘tis not. If anyone knows the secret ingredient I’m missing for that, please share and I’ll update the config.
Here’s the recipe. You can add it to Karabiner by going into Complex Modifications, clicking “Add your own rule,” and pasting the code below. If you play with modifications, please share! Despite using Karabiner for years now, I’m still learning my way around the rules.
{"description":"backslash down to right_command, double backslash to right_shift + right_command","manipulators":[{"conditions":[{"name":"backslash_pressed","type":"variable_if","value":1}],"from":{"key_code":"backslash","modifiers":{"optional":["any"]}},"to":[{"key_code":"right_shift","modifiers":["right_command"]}],"type":"basic"},{"from":{"key_code":"backslash","modifiers":{"optional":["any"]}},"parameters":{"basic.to_delayed_action_delay_milliseconds":250},"to":[{"set_variable":{"name":"backslash_pressed","value":1}},{"key_code":"right_command"}],"to_delayed_action":{"to_if_canceled":[{"set_variable":{"name":"backslash_pressed","value":0}}],"to_if_invoked":[{"set_variable":{"name":"backslash_pressed","value":0}},{"key_code":"backslash"}]},"type":"basic"}]}
Got any tricks you want to share? I’ve started a thread the forum and I’d love to see you there! I have a few more I’ll publish in the near future.
I tried changing the Autofill shortcut, but now holding the backslash launches DEVONthink Agent and I can’t figure out where I have that configured. Ugh. ↩