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)
- tags
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.jsonfield 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:
| Variable | Effect | Wheel scroll | Min version |
|---|---|---|---|
CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 | Disables click, drag, hover; mouse is still captured so the wheel works | ✅ kept | v2.1.195 |
CLAUDE_CODE_DISABLE_MOUSE=1 | Disables 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):
claude --versionConfirm 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:
# inside a Claude Code session, type:/tuiIt 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:
CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1 claudeClick 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):
echo 'export CLAUDE_CODE_DISABLE_MOUSE_CLICKS=1' >> ~/.zshrcPrefer the broader behaviour (kill mouse capture entirely, including wheel scroll — you then scroll with
PgUp/PgDn)? ExportCLAUDE_CODE_DISABLE_MOUSE=1instead.
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:
# new terminal tab, or reload the current shell:source ~/.zshrc
# fully quit any running Claude Code (Ctrl+C / exit), then start it again:claudeJetBrains / 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 ~/.zshrcin 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 asCLAUDE_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:
echo "$CLAUDE_CODE_DISABLE_MOUSE_CLICKS" # expect: 1Rollback
Re-enable mouse clicks by removing the export and restarting Claude Code.
# 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_CLICKSsource ~/.zshrcIf 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 setCLAUDE_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 (usePgUp/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
- Claude Code docs — Fullscreen rendering → Use the mouse / Keep native text selection — https://code.claude.com/docs/en/fullscreen#use-the-mouse
- GitHub issue #71687 —
CLAUDE_CODE_DISABLE_MOUSE_CLICKSadded in v2.1.195, documentation gap — https://github.com/anthropics/claude-code/issues/71687 - “Claude Code: disable mouse clicks with an env var” (israynotarray) — env-var-only, restart required, temporary modifier-key workarounds — https://israynotarray.com/en/ai/2026/06/29/claude-code-disable-mouse-clicks-env-var/