claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Terminal focus handling in mlterm

Open atondwal opened this issue 2 months ago • 1 comments

Bug Description terminal focus handling in mlterm --- see above

Environment Info

  • Platform: linux
  • Terminal: mlterm
  • Version: 2.0.57
  • Feedback ID: d07e9bf8-b7c7-4058-9816-5adedc0564d5

Errors

> when I do xmonad commands, I get > [O[O[I[O[I[O[I[O[I[O[I[O[I[O[I in claude code. what's going on there?

● This is a terminal focus reporting issue. The sequences [O and [I are partial ANSI escape codes for focus out (\e[O) and focus in (\e[I) events.

  What's happening:

  1. Your terminal has focus reporting enabled (CSI sequence \e[?1004h)
  2. When XMonad switches window focus, the terminal receives these focus change events
  3. Claude Code (or its underlying terminal handling) isn't properly consuming these escape sequences, so they leak through as visible text

  Why XMonad triggers it:

  Every time you use an XMonad keybinding that changes focus (switching workspaces, focusing windows, etc.), the terminal loses and regains focus rapidly,
  generating a burst of [I and [O sequences.

  Possible fixes:

  1. Disable focus reporting in your terminal - Most terminals have a setting for this. For example:
    - In mlterm: check config for focus event settings
    - In kitty: enable_focus_reporting no
    - In alacritty: not enabled by default
  2. Terminal multiplexer interference - If you're running inside tmux or screen, they sometimes pass through or mangle these sequences
  3. Report to Claude Code - This could be considered a bug where Claude Code enables focus reporting but doesn't properly handle the incoming sequences

  Which terminal emulator are you using? That would help narrow down the specific fix.

atondwal avatar Dec 03 '25 19:12 atondwal

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Jan 04 '26 10:01 github-actions[bot]

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] avatar Feb 03 '26 10:02 github-actions[bot]