anomalyco / anomalyco/opencode

fix: gnome-terminal mouse clicks stop working system-wide with two opencode instances

Open
#38,221 1 comment 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Jul 22, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When running two opencode instances in separate tabs of the same GNOME Terminal window, mouse left-click stops working across the entire GNOME/X11 desktop. Mouse movement and keyboard continue working, but mouse clicks stop being received by any application outside the active terminal window. This persists until GNOME Shell is restarted.

Environment

  • OS: Pop!_OS / Ubuntu 24.04
  • X11 session (not Wayland)
  • GNOME Terminal 3.52.0 with VTE 0.76.0
  • opencode 1.18.4

Reproduction

  1. Open GNOME Terminal
  2. Run opencode in the first tab
  3. Open a new tab (Ctrl+Shift+T) in the same window
  4. Run opencode in the second tab
  5. Try clicking anywhere outside the terminal (GNOME top bar, taskbar, app launcher, any other window)
  6. Mouse clicks are globally dead — only the active terminal tab receives clicks

Diagnostics collected

  • xinput query-state 13 confirms mouse button events reach X11 at the kernel level (button[1]=down seen when clicking) — libinput and evdev are working fine
  • Hotplugging the mouse (xinput disable 13 && xinput enable 13) does not fix it
  • gdbus call ... org.gnome.Shell.Eval 'global.stage.ungrab()' returns false — the grab is below the shell stage
  • killall -HUP gnome-shell does not fix it
  • setsid gnome-shell --replace & fully restores mouse clicks

Root cause analysis

This is technically a VTE / GNOME Terminal bug (VTE 0.76.0), not an opencode bug. VTE's mouse tracking mode uses standard ANSI escape sequences (\033[?1000h, \033[?1002h, \033[?1006h) which opencode uses correctly. When two tabs in the same VTE process both enter mouse tracking mode, VTE corrupts the X11 pointer grab state. The bad grab leak propagates to the X11 root window event mask, swallowing all mouse clicks globally.

Suggested opencode-side guard

While the upstream fix belongs in VTE, opencode could add a protection: detect when launching inside a terminal that already has mouse mode active (open another instance from opencode's built-in shell) and warn the user to use a separate terminal window instead of a new tab.

Workaround

Launch the second opencode in a separate GNOME Terminal window (Ctrl+Shift+N), not in a new tab (Ctrl+Shift+T) of the same window.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.