[Bug] Terminal focus handling in mlterm

Resolved 💬 3 comments Opened Dec 3, 2025 by atondwal Closed Feb 3, 2026

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.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗