Kitty keyboard protocol intercepts Caps Lock, breaking macOS IME switching

Resolved 💬 3 comments Opened Mar 25, 2026 by otbanha Closed Mar 29, 2026

Problem

When using Claude Code CLI in the terminal, pressing Caps Lock (used to switch input method on macOS, e.g., switching between Chinese/English) causes the escape sequence [57358u to be printed instead of switching the input language.

This does not happen in VS Code's integrated terminal or other terminals that do not enable the Kitty keyboard protocol.

Steps to Reproduce

  1. Open Claude Code CLI in macOS Terminal or iTerm2
  2. Set macOS input method shortcut to Caps Lock (System Settings → Keyboard → Input Sources → Use Caps Lock to switch)
  3. Press Caps Lock while focus is in Claude Code
  4. [57358u appears in the input instead of switching the IME

Expected Behavior

Caps Lock should switch the macOS input method as normal, not produce an escape sequence.

Actual Behavior

[57358u (Kitty keyboard protocol CSI u sequence for Caps Lock, keycode 57358) is printed to the input.

Environment

  • macOS (Darwin 23.6.0)
  • Claude Code CLI
  • Input method: macOS built-in Chinese/English toggle via Caps Lock

Root Cause

Claude Code enables the Kitty keyboard protocol in the terminal, which intercepts modifier keys like Caps Lock and encodes them as escape sequences instead of passing them through to the OS input method system.

Workaround

Use a different keyboard shortcut for IME switching (e.g., Control+Space or Command+Space) instead of Caps Lock.

View original on GitHub ↗

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