Skip to content

Fixed-location mode clicks wherever the cursor is after the first click #62

Closed

Description

@TMHSDigital

Why it matters

In Fixed location mode the app promises to click at X/Y. In practice, after the first click, every later click lands wherever the mouse currently is. If the user nudges the mouse (to check something, or by bumping the desk), the clicks follow the cursor into other windows: the taskbar, a browser tab's close button, a "Delete" button. For an app pitched as "pixel-precise" with "safety on by default", clicking somewhere the user never picked is the most serious failure mode it can have. The corner failsafe only helps if the cursor reaches a corner of the primary monitor.

Evidence

autoclicker/core/click_engine.py:424-435:

# Instant move; skip if already at target (avoids moveTo overhead each click)
if self._last_click_xy != (x, y):
    pyautogui.moveTo(x, y, duration=0)
    self._last_click_xy = (x, y)
...
pyautogui.click(button=mouse_button, clicks=2 if click_type == "double" else 1)

_last_click_xy records where we last moved the cursor, not where the cursor is. pyautogui.click() without x/y clicks at the current cursor position. After the first click _last_click_xy == (x, y) for the rest of the run, so the move is skipped and the click goes to the live cursor position. tests/test_click_engine.py:78-83 (test_skips_move_when_same_coordinates) locks this behavior in.

Suggested approach

Pick one behavior deliberately and document it:

  • Option A (recommended): always click at the target. Pass the coordinates to the click call, pyautogui.click(x, y, button=..., clicks=...), or compare against GetCursorPos (cheap) and move only when the cursor is elsewhere. The original perf concern is small with PAUSE = 0; re-measure with scripts/profile_click_engine.py and update docs/PERFORMANCE.md.
  • Option B: treat user mouse movement as a stop signal. If the cursor is not where we left it, stop with a clear reason ("Stopped: mouse moved"). Several popular autoclickers offer this as an option; it could be a checkbox in Advanced, in addition to Option A.

Done when

  • In Fixed mode, moving the mouse mid-run never causes a click anywhere except the target (Option A), or ends the run with a clear status and one sessions.log stop line (Option B).
  • The old test is replaced by one that simulates a cursor moved away (pyautogui.position returning a different point) and asserts the chosen behavior.
  • README "Pick and click" and Safety sections describe it, and the fix is in the next release.

Activity

  1. added
    bug
    priority: high
    safety
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority: highsafety

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions