Karabiner: Rethinking Right-Click as a Macro Command Center

Karabiner isn't only for your keyboard. It can also hijack your mouse buttons and enable them to be similar to layers on your keyboard, where holding down a mouse button can allow you to tap keys on your keyboard to trigger commands and macros that can completely revolutionize your workflows. For example, you can hold down the right mouse button and tap on R to go to references in VS Code. Or hold down the right mouse button and tap the left mouse button to chop up videos and Screenflow.

This completely unlocks a whole new world of possibilities and use cases for your mouse as you can hover your mouse over anywhere on the page. And just tapping keys on your keyboard allows you to trigger mouse actions, to trigger keyboard actions, or to trigger macros and applications and terminal commands. and anything that your imagination can come up with.

Share with a coworker

Transcript

[00:00] In Karabiner if you open the settings and go down to devices and scroll down and enable your mouse and allow it to modify events you can now capture and modify the behavior of individual mouse buttons. And this syntax here reads when I right-click or button 2 set the button 2 mode variable to 1 without any conditions, and if I don't do anything else when I release just right-click, and when I release disable the button 2 mode variable. So when I right-click you see I still have right-click available, but in Karabiner if you check the event viewer and go down to variables when I'm holding down the right mouse button you'll see the button 2 mode right here switches to 1. So release, click down, release, you'll see that variable is toggling to 1. And what that means is I can now create a section kind of like a layer on a keyboard for when button 2 mode is enabled.

[00:50] For example when that variable is 1 and I left-click we can tell it to left-click with shift pressed. So I'm holding down the right mouse button and left-clicking and you can see I'm selecting text just by left-clicking with the right mouse button held down. Similarly if I hit button 5, which is one of the side buttons on my mouse, I can right-click, button 5, and toggle mission control. You can also set up macros. For example, when I press A, it will left-click and then hit command A.

[01:20] So hold down right-click, tap A, it selects all. Same thing with the other keys ZX, C, V, B. So I'm holding down right-click, I tap X, and I'm cutting individual lines. I'm tapping V and I'm pasting lines, I'm tapping Z and I'm undoing. This is also very useful for things like navigation in VS Code where I can go here, I'll hover my mouse over here, hold down right-click and tap R for references and it'll show me all the references.

[01:46] And you can essentially just hold down your right mouse button and tap R all throughout the file. And since it left clicks and triggers a keyboard shortcut, you can jump around your code base very quickly.