2021-02-02

Enable 3 Finger Drag on Windows

3 Finger Drag (3FD) is not available on Windows, and not built-in on Linux

For Linux support, I'll write another post in the future.

On Windows, we can achieve something similar.  Let's call this:  3 Finger Tap to Drag Lock.

It's Dakshin's idea [1], refined further [2] and tweaked below.

What's 3FD anyway?

3 Finger Drag refers to a Mac accessibility feature.  When enabled, if you place three fingers on the Mac's trackpad or touchpad, then move those fingers in unison on the trackpad, the mouse pointer behave as if you left-clicked-and-are-dragging.

It's a better more ergonomic alternative to the tap-twice-and-drag method that's common on Macs, Windows, and Linux.

It's better because there's less finger tapping movement which can develop into "trigger finger" type repetitive strain injury.  If you drag things around a lot, tap-twice-and-drag plus another tap to deactivate dragging starts to add up to being a nuisance!

And at least for me, when dragging using the  tap-twice-and-drag gesture, I often have trouble continuing to drag mid-drag if I lift my hand away from the trackpad to reposition.  And ironically, I also have trouble disengaging the drag once I've reached the target of the drag motion too!

3 Finger Tap to Drag Lock (3FTD) on Windows

The gesture allows you to tap on the trackpad with 3 fingers, which will "lock" the left click down.  Then you can use 1 finger to move the cursor around, thus dragging what's clicked on!  A single tap again will disengage it.

You'll need to install AutoHotKey (AHK) as this is a script continuously running in the background to make it happen.

Installing the AHK Script

Make a text file and copy the script below into it, then save the text file with a .ahk file extension.  Double click the .ahk script file and AutoHotKey will run it to give you this 3FTD behaviour.

If you want the script to run every time you log in to Windows, you'll need to move the script or add a shortcut to it into the Windows startup folder.  See detailed instructions [3] for that.

ThreeFingerTapDragLock.ahk

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance force

drag_enabled := false

; Key combo for 4 finger tap:  #^+F24
#^+F22:: ; 3 finger tap
    if (drag_enabled) 
        Click, Up
    else
        Click, Down
    drag_enabled := !drag_enabled
return

#If drag_enabled
LButton::
    Click, Up
    drag_enabled := false
return
#If

Limitations of this script: games and VirtualBox

Chances are, this script won't work inside games.  Many games access the mouse and keyboard at a lower level than what AHK can effectively manipulate, or has anti-scripting functionality built-in.

AHK also doesn't play nice with VirtualBox since it's virtualizing the keyboard and mouse for the guest OS!

To avoid problems with VirtualBox, I tweaked the above script so it only works outside of it:

ThreeFingerTapDragLock_OutsideVBox.ahk

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance force

drag_enabled := false

#If !WinActive("ahk_exe VirtualBoxVM.exe")
; Key combo for 4 finger tap:  #^+F24
#^+F22:: ; 3 finger tap
    if (drag_enabled) 
        Click, Up
    else
        Click, Down
    drag_enabled := !drag_enabled
return


#If drag_enabled && !WinActive("ahk_exe VirtualBoxVM.exe")
LButton::
    Click, Up
    drag_enabled := false
return
#If

Note about the Key combo

My trackpad's 3 finger tap sends the key combo Win+Ctrl+Shift+F22.

And it's F24 instead of F22 if I 4 finger tap.

So the Key combo in the scripts above can be easily changed if you prefer a 4 finger instead of 3 finger gestures.

But also, if your laptop or vendor trackpad is different, you'll have to use AHK to find out the appropriate key combo to put in the script instead.


References

[1] Enable 3 Finger Gesture for click and drag on Windows and Linux

[2] AutoHotKey - Three finger dragging script causing minor issue, how to fix?

[3] How to Schedule AutoHotKey to Start Up with Windows

No comments: