Skip to content

fix(macos): SKK direct input lost and IME mode-switch keys leaking to shell#1561

Open
shiena wants to merge 2 commits intoraphamorim:mainfrom
shiena:feature/macos-forward-to-ime-modifier-mask
Open

fix(macos): SKK direct input lost and IME mode-switch keys leaking to shell#1561
shiena wants to merge 2 commits intoraphamorim:mainfrom
shiena:feature/macos-forward-to-ime-modifier-mask

Conversation

@shiena
Copy link
Copy Markdown
Contributor

@shiena shiena commented Apr 26, 2026

Fixes #1560.

Summary

Three macOS IME fixes for SKK-derived input methods (macSKK, AquaSKK) plus a new configurable modifier mask that decides which key events are forwarded to interpretKeyEvents:.

Behavior changes

  • IME direct commits without preedit (SKK hiragana/katakana mode) are now delivered: typing a in hiragana mode inserts instead of a.
  • Ctrl+J, q, and other keys macSKK consumes via IMKTextInput::selectMode() only no longer leak through as raw input —no stray newlines or letters when switching IME mode.

New config

[keyboard]
forward-to-ime-modifier-mask = ["shift", "ctrl", "alt", "super"]

A key event is forwarded to the macOS IME when no modifier is pressed, or when the pressed modifiers intersect this mask.
The default keeps the historical behavior, so existing setups are unaffected.

Accepted values (case-insensitive): shift, ctrl (alias control), alt (alias option), super (aliases cmd, command).

Recommended for SKK users:

[keyboard]
forward-to-ime-modifier-mask = ["shift", "ctrl"]

This lets Ctrl+J, Ctrl+G, Shift+letter reach the IME while keeping Cmd+key and Alt+key for terminal shortcuts.

@shiena shiena force-pushed the feature/macos-forward-to-ime-modifier-mask branch from ddbe419 to 25af40e Compare April 26, 2026 14:26
@shiena shiena changed the title Fix macOS IME handling for SKK and add forward-to-ime-modifier-mask fix(macos): SKK direct input lost and IME mode-switch keys leaking to shell Apr 26, 2026
@shiena shiena force-pushed the feature/macos-forward-to-ime-modifier-mask branch 6 times, most recently from 8b0dffe to 304eede Compare May 1, 2026 11:10
@shiena shiena force-pushed the feature/macos-forward-to-ime-modifier-mask branch 4 times, most recently from 1034e3b to db5884a Compare May 3, 2026 08:38
- gate interpretKeyEvents: forwarding by a configurable modifier mask
- handle IME direct commits without preedit (e.g. SKK kana mode)
- swallow keys consumed via IMKTextInput.selectMode (SKK Ctrl+J, q)
@shiena shiena force-pushed the feature/macos-forward-to-ime-modifier-mask branch from db5884a to 37a59de Compare May 4, 2026 03:03
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.

macOS: SKK and other modifier-aware IMEs don't behave as expected

2 participants