A trackpad middle-click hack for Bootcamp/Windows using AutoHotKey

A great feature of both my Mac and my Chromebook is that middle-clicks are built into the trackpad by tapping with 3 or 4 fingers at once. But in Bootcamp (and with most Windows trackpads too) there is no equivalent to a triple-finger tap built into the drivers. Among many uses, the middle click is a dead easy way of closing tabs in Chrome without worrying about that fiddly tiny little close button – a feature I miss when using Windows.

To solve this, it’s AutoHotKey to the rescue! Credit to Lifehacker reader Nakul – I have a slightly modified the script to turn a double-right-click into a middle click. Note that this might not be suitable if you use applications that have specific actions for double-right-clicks, but for the vast majority of people this shouldn’t be an issue.

~RButton::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
{
Click middle
}
Return

Simply install AutoHotKey, right click on the notification icon by the clock, click ‘Edit This Script’ and paste the above code. Save the notepad file and then reload the script.

The way that the script works is that, whenever the right mouse button is pressed, the code on the second line is called. If the code is called twice in a row, with 500ms between each call, then it simulates a middle-click. You can change the 500 value to a higher or lower value (in milliseconds) if you prefer.

To use the script with a trackpad, do a two-finger tap (as you would normally do for a right-click) twice quickly. It might make the right-click menu appear, but the second right-click should make it hide again.

2 thoughts on “A trackpad middle-click hack for Bootcamp/Windows using AutoHotKey”

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: