in discussion: https://github.com/ibus/ibus/issues/2600#issuecomment-1904322441 the summary is that the StateNotify event which is used to update the xkd modifier state is sourced directly from the X server and doesn't account for any state maintained by the IME. The key press and release events do include the correct state, so we should always prefer to use the modifiers from those events on X11. Under wayland, we continue to use the kbd state. refs: https://github.com/ibus/ibus/issues/2600 refs: https://github.com/wez/wezterm/pull/4151