Create a Minecraft Left-Click Toggle on Linux Mint Cinnamon

This tutorial shows how to make one keyboard key hold left click for Minecraft.

After setup:

  • Press F8 once to start holding left click.
  • Press F8 again to stop holding left click.

Use this only in single-player or on servers where automation is allowed.

What You Need

This guide is for Linux Mint Cinnamon using X11.

You also need a small tool called xdotool. It lets Linux press or release mouse buttons from a command.

Open Terminal with:

Ctrl + Alt + T

Install xdotool:

sudo apt install xdotool

If it is already installed, Linux will tell you and do nothing harmful.

Step 1: Create the Script

In Terminal, run:

mkdir -p "$HOME/bin"
xed "$HOME/bin/minecraft-left-toggle"

A text editor should open.

Paste this into the file:

#!/usr/bin/env bash
set -euo pipefail

state_file="/tmp/minecraft-left-toggle-${UID}.state"

export DISPLAY="${DISPLAY:-:0}"
if [[ -z "${XAUTHORITY:-}" && -e "${HOME}/.Xauthority" ]]; then
  export XAUTHORITY="${HOME}/.Xauthority"
fi

if [[ -e "$state_file" ]]; then
  xdotool mouseup 1
  rm -f "$state_file"
else
  xdotool mousedown 1
  printf '%s\n' "$(date +%s)" > "$state_file"
fi

Save the file and close the editor.

Step 2: Make the Script Runnable

In Terminal, run:

chmod +x "$HOME/bin/minecraft-left-toggle"

This allows Linux to run the script.

Step 3: Add the Keyboard Shortcut

Open Cinnamon keyboard settings:

System Settings -> Keyboard -> Shortcuts -> Custom Shortcuts

Add a new custom shortcut.

Use this name:

Minecraft left-click toggle

Use this command:

bash -lc "$HOME/bin/minecraft-left-toggle"

Set the shortcut key to:

F8

Now the shortcut is ready.

Step 4: Use It in Minecraft

  1. Open Minecraft.
  2. Join your world.
  3. Aim at the block you want to mine.
  4. Press F8.
  5. Left click should stay held down.
  6. Press F8 again to stop.

If it works on the desktop but not inside Minecraft, switch Minecraft to windowed or borderless fullscreen mode and try again.

Emergency Stop

If the mouse ever gets stuck, open Terminal and run:

xdotool mouseup 1

This releases the left mouse button.

Troubleshooting

If F8 does nothing, check these things:

  1. Make sure the shortcut command is exactly:

    bash -lc "$HOME/bin/minecraft-left-toggle"
    
  2. Make sure the script exists:

    ls "$HOME/bin/minecraft-left-toggle"
    
  3. Make sure the script is runnable:

    chmod +x "$HOME/bin/minecraft-left-toggle"
    
  4. Try running the script manually:

    "$HOME/bin/minecraft-left-toggle"
    

    Run the same command again to stop holding left click.

  5. If it works outside Minecraft but not inside Minecraft, change Minecraft from fullscreen to windowed or borderless fullscreen mode.

  6. If Cinnamon still does not notice the shortcut, log out and log back in.