Stop Claude Code from hijacking mouse clicks (fullscreen mouse capture) on Linux & macOS

Published 7 July 2026

date
env
linux Fedora 44 — Claude Code v2.1.195+ (any terminal; tested in the JetBrains/IntelliJ integrated terminal) macos macOS 26 — Claude Code v2.1.195+ (any terminal; tested in the JetBrains/IntelliJ integrated terminal)

Symptom

Since a recent Claude Code version, the CLI captures mouse events and handles them itself instead of letting the terminal deal with them. In day-to-day use that means:

  • Clicking inside the prompt repositions the text cursor wherever you clicked, instead of doing nothing.
  • Clicking a row in a menu (permission prompt, /model, /config, a / command or @ file suggestion) selects that option.
  • Click-and-drag now selects text inside Claude Code rather than in the terminal’s own selection buffer.

If, like me, you habitually click into the prompt in the JetBrains / IntelliJ terminal to place your cursor, it is far too easy to land a stray click on “Ask something” or on a cancel / menu entry and trigger it by accident. The feature is convenient for some; for this workflow it mostly gets in the way. I want clicks (and drags, and hover) to do nothing, while keeping mouse-wheel scrolling.


Root cause

This is mouse capture, part of Claude Code’s fullscreen rendering mode (the flicker-free renderer that draws on the terminal’s alternate screen buffer, like vim/htop). When it is active, the CLI asks the terminal to forward mouse events and then interprets clicks, drags, hover and the wheel internally — see the official Use the mouse docs (Sources).

Two things make it feel abrupt:

  • It is on by default once fullscreen rendering is active, and there is no in-app toggle for clicks — the /config “Copy on select” option only affects auto-copy, not click handling.
  • The knobs are environment variables only. There is no settings.json field and no CLI flag for this — confirmed by the docs and by the open documentation issue #71687, which exists precisely because the variable was shipped (v2.1.195) before being documented.

The relevant variables:

VariableEffectWheel scrollMin version
CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1Disables click, drag, hover; mouse is still captured so the wheel works✅ keptv2.1.195
CLAUDE_CODE_DISABLE_MOUSE=1Disables all mouse capture, including the wheel❌ gone (use PgUp/PgDn)earlier

If both are set, CLAUDE_CODE_DISABLE_MOUSE takes precedence.

For the accidental-click problem, CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 is the right choice: clicks stop doing anything inside Claude Code, but the wheel and touchpad still scroll the conversation.


Diagnosis (optional)

Check your version is new enough for the fine-grained variable (needs 2.1.195 or later):

Terminal window
claude --version

Confirm fullscreen rendering is what’s capturing the mouse: if the input box stays pinned at the bottom of the screen while Claude works (instead of scrolling up with the output), fullscreen rendering is active. You can also ask:

Terminal window
# inside a Claude Code session, type:
/tui

It prints which renderer is active (fullscreen or default).


Solution

Set the environment variable so every new Claude Code session inherits it, then restart Claude Code.

One-off test first (no config change)

Prove it does what you want before making it permanent — launch a single session with the variable set:

Terminal window
CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 claude

Click in the prompt and on a menu row: nothing should happen. Spin the wheel: it should still scroll. Good — now make it stick.

Make it permanent (Fedora 44 & macOS 26)

Add the export to your shell profile. On both this Fedora box and macOS 26 the shell is zsh, so use ~/.zshrc (use ~/.bashrc if you’re on bash):

Terminal window
echo 'export CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1' >> ~/.zshrc

Prefer the broader behaviour (kill mouse capture entirely, including wheel scroll — you then scroll with PgUp/PgDn)? Export CLAUDE_CODE_DISABLE_MOUSE=1 instead.

Reload and restart Claude Code

The variable is read at launch. A session that is already running will not pick it up — you must quit and relaunch:

Terminal window
# new terminal tab, or reload the current shell:
source ~/.zshrc
# fully quit any running Claude Code (Ctrl+C / exit), then start it again:
claude

JetBrains / IntelliJ specifics

The IDE’s integrated terminal inherits its environment from the shell it launches (which reads ~/.zshrc), so the export above covers it. Two gotchas:

  • Close and reopen the IDE terminal tab (or run source ~/.zshrc in it) after editing the profile — an already-open terminal keeps the old environment.
  • If the IDE terminal is configured to run a non-login/non-interactive shell and doesn’t read ~/.zshrc, either point Settings → Tools → Terminal → Shell path at an interactive login shell (e.g. /bin/zsh -l), or set the variable in Settings → Tools → Terminal → Environment variables as CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1. Restart the IDE terminal afterwards.

Verify

In a freshly started Claude Code session:

  • Click inside the prompt — the cursor must not jump to the click point.
  • Open a menu (e.g. run /model) and click a row — it must not select; only the keyboard (arrows + Enter) chooses.
  • Scroll the wheel / two-finger scroll — the conversation should still scroll (this confirms you used ..._MOUSE_CLICKS, not the full ..._MOUSE).

Confirm the variable is actually exported in the session’s environment:

Terminal window
echo "$CLAUDE_CODE_DISABLE_MOUSE_CLICKS" # expect: 1

Rollback

Re-enable mouse clicks by removing the export and restarting Claude Code.

Terminal window
# delete the line you added:
sed -i '/CLAUDE_CODE_DISABLE_MOUSE_CLICKS/d' ~/.zshrc # macOS: sed -i '' '/CLAUDE_CODE_DISABLE_MOUSE_CLICKS/d' ~/.zshrc
# drop it from the current shell and relaunch Claude Code:
unset CLAUDE_CODE_DISABLE_MOUSE_CLICKS
source ~/.zshrc

If you also set it in the JetBrains terminal’s Environment variables field, clear it there and restart the IDE terminal.

To keep it disabled most of the time but occasionally use the mouse, don’t make it permanent — just launch those sessions with CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 claude on demand instead.


Alternatives

  • Turn off fullscreen rendering completely — this removes mouse capture along with the flicker-free renderer. Inside a session run /tui default, or set CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1. You lose the flat-memory, no-flicker benefits, so prefer the mouse-only variable if you like fullscreen otherwise.
  • Kill all mouse capture, keep fullscreen — CLAUDE_CODE_DISABLE_MOUSE=1. Restores native terminal click-and-drag selection but removes in-app wheel scrolling (use PgUp/PgDn, Ctrl+Home/Ctrl+End).
  • Keep capture, just want a native selection now and then — hold a modifier while dragging so the terminal handles it: Shift in the JetBrains/VS Code terminals and most emulators, Option in iTerm2, Fn in macOS Terminal.app.
  • Disable only auto-copy on select (unrelated to clicks) — toggle Copy on select in /config.

Sources