Enable 3 Finger Gesture for click and drag on Windows and Linux
Three finger drag is a multi-touch gesture on Mac OS that simulates the click and drag gesture for selecting text, resizing windows and other things. People who spend their time switching between OSs can get very used to this gesture because of its simplicity and ease of use, but it can break your workflow and cause unnecessary stress when you find that the feature is missing on non-Apple devices. This guide details the procedure to getting similar gestures up and running on any other laptop with a touchpad that supports multi-finger gestures.
Note: For some reason, this setting is disabled by default on newer versions of Mac OS, so if you haven’t used this feature on a MacBook before, I highly recommend trying it out. The setting is under the Accessibility menu in System Preferences.
To enable this on Windows, we will be using a scripting engine called AutoHotKey. This engine basically monitors for keyboard and mouse events, and allows you to write instructions that will be executed when a specific input event is triggered. Now, unfortunately Windows does not fire an event as soon as your fingers touch the pad, but only when you touch the trackpad and raise your fingers, i.e. a three finger tap. (This gesture normally opens Cortana on Windows 10). Since Windows is not open source — Thanks, Microsoft! — the only way to implement true 3 finger drag would be by creating a custom trackpad driver like this one or by using Microsoft’s raw device input APIs . Both of these options require details specific to different latptop models, like the hardware vendor ID or HID Usage ID, so it’s not possible to have a solution that works out of the box on all Windows laptops.
So this is how my solution using AutoHotKey works:
- Position your mouse wherever you want to click and drag from and do a 3 finger tap on the touchpad
- Move the mouse using a single finger like you normally do, except now the system acts like you’re click-and-dragging to that location. You can take your finger off the touchpad and on again to cover large portions of the screen, or even use the two finger gesture to scroll through large articles like this one and select the entire text.
- When you’re done selecting, tap again either with a single finger or with 3 to end the gesture. You can now copy your selected text, or if you’d been moving windows around, it will now stop following your cursor. (I found that a single finger tap to end the gesture to end the drag feels much more natural, however I added the three finger as well for consistency.)
If you’re ready to try it out on your machine, follow the instructions below:
- Download and install AutoHotKey from https://www.autohotkey.com
- Download my AutoHotKey script from here (The code is available below as well)
- Double click the ahk file you downloaded to run it, and then test out your new gesture by following the explanation above to select this article! :)
- If you like the gesture and want to keep it on permanently, you’ll need to add a shortcut to the .ahk file to your Windows startup folder. Click here for instructions on that.
Source code for the script:
That’s it! This method will work on every Windows Precision touchpad, and even on older ones that support three finger taps (Most Lenovo laptops that use Symantec touchpads).
Linux users can rejoice, as none of the caveats I mentioned above for Windows are applicable here. You really will get true three-finger drag gesture on Linux, and it should work regardless of whether you use Xorg or Wayland, or Gnome/Xfce/KDE. (Note: Tested on Ubuntu 20.04 with Gnome on both Xorg and Wayland) This does require that your touchpad be using the libinput drivers, which is the default on basically every distro updated in the last few years.
A warning before you begin: This procedure is a little risky, and you may lose control of your mouse and trackpad if this goes wrong. Make sure you can access your machine through some other setup like SSH. If following these instructions fails, you will need to revert to the default libinput installation
- Download the patched, precompiled binary for libinput here. It was compiled on a 64 bit Ubuntu machine (AMD64). Please comment with your system details if the binary doesn’t work on your laptop. If you’d prefer, you can also manually compile libinput from the patched code and install it. Code and installation instructions are all available from the link to the original post above.
- Open a terminal and cd to wherever you downloaded the file. Run the following two commands:
3. Log out and log back in
Note: If your screen went blank when you typed out these commands, don’t fret. Wait for a few minutes and your DE will restart.
I hope you found this gesture as useful as I did. Feel free to comment below with suggestions or questions.