Skip to content

fix(kimi-code): avoid terminal focus flicker on Linux Wayland - #1094

Merged
liruifengv merged 2 commits into
mainfrom
fix/linux-wayland-focus-flicker
Jun 25, 2026
Merged

fix(kimi-code): avoid terminal focus flicker on Linux Wayland#1094
liruifengv merged 2 commits into
mainfrom
fix/linux-wayland-focus-flicker

Conversation

@liruifengv

Copy link
Copy Markdown
Collaborator

Related Issue

Resolve #1090

Problem

On Linux Wayland, starting Kimi Code made the terminal window repeatedly gain and lose focus (dock icon bouncing, GNOME meta_window_set_stack_position_no_sync assertion), which broke IME input. See the linked issue for the full report.

What changed

The clipboard image paste hint probed the system clipboard on every terminal focus event. On Linux that probe spawns wl-paste/xclip, which on Wayland perturbs seat focus and re-triggers the focus event, forming a focus feedback loop.

The probe now runs only on macOS and Windows, which use the in-process native module and do not perturb focus. On Linux the focus-driven hint is disabled; pasting images still works through the explicit paste path on all platforms.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

The focus-driven clipboard image hint spawned wl-paste/xclip on every
terminal focus event. On Wayland this perturbs seat focus and re-triggers
the focus event, creating a feedback loop that made the terminal window
repeatedly gain and lose focus and broke IME input.

Limit the probe to macOS and Windows, which use the in-process native
module and do not perturb focus. Image paste is unaffected.

Resolve #1090
@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4098b3d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 25, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@4098b3d
npx https://pkg.pr.new/@moonshot-ai/kimi-code@4098b3d

commit: 4098b3d

@liruifengv
liruifengv merged commit 8ee5c0f into main Jun 25, 2026
8 checks passed
@liruifengv
liruifengv deleted the fix/linux-wayland-focus-flicker branch June 25, 2026 04:59
@github-actions github-actions Bot mentioned this pull request Jun 25, 2026
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Jul 11, 2026
…otAI#1094)

The focus-driven clipboard image hint spawned wl-paste/xclip on every
terminal focus event. On Wayland this perturbs seat focus and re-triggers
the focus event, creating a feedback loop that made the terminal window
repeatedly gain and lose focus and broke IME input.

Limit the probe to macOS and Windows, which use the in-process native
module and do not perturb focus. Image paste is unaffected.

Resolve MoonshotAI#1090

(cherry picked from commit 8ee5c0f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 0.19.2 在 Ubuntu 26.04 + GNOME 50 Wayland + Ptyxis + ibus-rime 下导致终端焦点循环闪烁

1 participant