Skip to content

Transport the cursor to the center of frontmost window

My home workspace is a 27" Retina 5K iMac (2560x1440) paired with a vertical 4K display (scaled to view 1440x2560). While I love this setup in general, there's one time it's annoying: When I need to move the cursor between displays, and it's located far away from its destination.

There are many ways to solve this problem, including our own Keymo, which I still use when I want to teleport a drag across displays. But what I really wanted was a fast way to move the cursor to the other display when I switched to a window on the other display—because generally, if I've activated the window, I'm probably going to use the mouse in that window at some point.

Using Keyboard Maestro, it's possible to create a macro to make this happen automatically:

This macro will activate every time you switch applications, and then move the mouse to the center of that newly-frontmost window and highlight its location with a quick circle. Having tested this, however, I can say it's a non-ideal solution: Most of the time when I switch an app, I do not want the cursor to move. I found it more annoying—much more annoying—than useful.

As useless as the above macro is, with one minor change it quickly became one of my most-used macros…

Here's the revised macro [download]:

The change is in the activation method: When I double-tap the left-hand Command key (⌘), the cursor will jump to the center of the frontmost window and call itself out. Here's how it looks in a cheesy little GIF:

I use our own Witch to switch between open windows (and as of 4.0, tabs), and have it assigned to Command-Tab. In the span of only a few days, it's become second nature to press Command-Tab, then double-tap the Command key when I want the cursor to follow.

There's only one minor trick to setting this up, if you're not using the downloaded version: If you look at the Triggers pop-up menu, you won't see This device key listed anywhere.

But as shown at right, you will see USB Device Key Trigger, and that's the one you want to select. Notice, too, that you can assign right and left modifier keys independently, if you wish.

With this macro, I'm doing a lot less long-distance mousing, which is both good for the wrists and quicker, as the mouse movements I do make are much shorter.

1 thought on “Transport the cursor to the center of frontmost window”

Comments are closed.