anomalyco / anomalyco/opencode
fix: gnome-terminal mouse clicks stop working system-wide with two opencode instances
@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
- Open GNOME Terminal
- Run
opencodein the first tab - Open a new tab (Ctrl+Shift+T) in the same window
- Run
opencodein the second tab - Try clicking anywhere outside the terminal (GNOME top bar, taskbar, app launcher, any other window)
- Mouse clicks are globally dead — only the active terminal tab receives clicks
Diagnostics collected
xinput query-state 13confirms mouse button events reach X11 at the kernel level (button[1]=downseen 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()'returnsfalse— the grab is below the shell stagekillall -HUP gnome-shelldoes not fix itsetsid 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.