Whenever the touchpad is touched, this macro will map the keyboard keys j, k, and l to the mouse buttons left, middle, and right respectively.
This allows your right hand to press mouse buttons while controlling the touchpad with its thumb, allowing applications that require the use of a mouse to be operated from the touchpad. Examples of such applications include Solidworks, blender, and games like Minecraft or Fortnite.
When you need a mouse but do not have one near you right now.
The key map below only applies while the touchpad is touched, all keys will behave normally otherwise.
| Key | Mapped |
|---|---|
j |
Left Mouse Button |
k |
Middle Mouse Button |
l |
Right Mouse Button |
i |
Scroll Down |
o |
Scroll Up |
- This project was tested to work on Linux Mint cinnamon and will likely work on other distributions of Linux. If it doesn't, please open an issue. If it does, please let me know in the discussions.
- For Windows refer to Touchpad-Mouse-Emulator.
- Ensure you have Python 3 installed.
- Ensure these python libraries are supported
- asyncio
- evdev
- Make sure your os can access input devices through paths like
/dev/input/event6(Linux Mint does this, most other distributions may too) - It is beneficial to have the
libinputcli is installed
- Download the script.
- Unzip the script
- Navigate to the script with this command or similar
cd ~Downloads/Auto-Touchpad-Mouse-Emulator- modify the strings in the three calls to
find_device_path_evdev()to match the name of your pointer devices, note that the mouse detection is used to exits the program when it is not needed.- To see what this name of your devices is, you can run
libinput list-devicesin the terminal to list all devices. - If you are unsure which is which, you can: run
sudo libinput debug-events, use the device in question, and see what number is on the shown path, this path you can also find inlibinput list-deviceswhere you can find its name.
- To see what this name of your devices is, you can run
- Run it with the command below to test it (uses administrator privileges).
sudo python3 mousemap.py- Navigate to the file in the terminal using
cdand use the command below to make the file runnable
chmod +x mousemap.py- Finally run the path to your file as a command like below every time you want to run it:
/home/your-user-name/Scripts/mousemap.pyYou can review, paste, and run the script below at your own risk, it might save you some time.
# Safe Auto-Touchpad Mouse Emulator Installer
# Copy-paste into terminal
set -e # Stop immediately if any command fails
RELEASE_URL="https://github.com/SP4CEBARsystems/Auto-Touchpad-Mouse-Emulator/archive/refs/tags/v1.0.0.tar.gz"
INSTALL_DIR="/opt/auto-touchpad-mouse"
SYMLINK="/usr/local/bin/auto-touchpad-mouse"
TMP_ARCHIVE="/tmp/auto-touchpad-v1.0.0.tar.gz"
# 1. Download the release
echo "Downloading Auto-Touchpad Mouse Emulator..."
wget -O "$TMP_ARCHIVE" "$RELEASE_URL"
# 2. Create the installation directory (fails if it already exists)
echo "Creating installation directory at $INSTALL_DIR..."
sudo mkdir "$INSTALL_DIR"
# 3. Extract into /opt
echo "Extracting files..."
sudo tar -xzf "$TMP_ARCHIVE" -C "$INSTALL_DIR" --strip-components=1
# 4. Make the script executable
sudo chmod +x "$INSTALL_DIR/mousemap.py"
# 5. Create symlink (fails if it already exists)
sudo ln "$INSTALL_DIR/mousemap.py" "$SYMLINK"
# 6. Clean up
rm "$TMP_ARCHIVE"
echo ""
echo "=== Installation Complete ==="
echo "Run the emulator from anywhere with: auto-touchpad-mouse"
echo "Edit device paths if needed: sudo nano $INSTALL_DIR/mousemap.py"