protonscr

[Feature Request] Improve IME compatibility by adding adaptive setup_ime_env to steam launcher script

steamclosed Feature Request
ValveSoftware/steam-for-linux#12568 · opened 2025-12-20 by wzyou · updated 2025-12-20 · 1 comments · github
Wwzyou 2025-12-20 github

Description:

Currently, many Linux users (especially CJK users) encounter issues where Input Method Editors (IME) like Fcitx5 or IBus fail to work within the Steam client or games. This is often due to missing or mismatched environment variables (GTK_IM_MODULE, QT_IM_MODULE, SDL_IM_MODULE).

While users can manually set these in /etc/environment, it often leads to conflicts or fails to load correctly across different desktop environments.

Proposed Solution:

Modify the Steam launcher script (e.g., /usr/games/steam) to include an adaptive IME environment setup logic. This approach is inspired by the implementation used in the WeChat Linux client, which has proven to be robust and user-friendly.

Suggested Code Implementation:

Adding a function like this to the beginning of the steam wrapper script:

setup_ime_env() {
  # Detect IME framework based on XMODIFIERS
  if [[ "$XMODIFIERS" =~ fcitx ]]; then
    [ -z "$QT_IM_MODULE" ] && export QT_IM_MODULE=fcitx
    [ -z "$GTK_IM_MODULE" ] && export GTK_IM_MODULE=fcitx
    [ -z "$SDL_IM_MODULE" ] && export SDL_IM_MODULE=fcitx
  elif [[ "$XMODIFIERS" =~ ibus ]]; then
    [ -z "$QT_IM_MODULE" ] && export QT_IM_MODULE=ibus
    [ -z "$GTK_IM_MODULE" ] && export GTK_IM_MODULE=ibus
    [ -z "$SDL_IM_MODULE" ] && export SDL_IM_MODULE=ibus
  fi
}

setup_ime_env

Why this is better:

  1. Non-destructive: It only exports variables if they are currently empty (-z), respecting user-defined overrides.

  2. Adaptive: It automatically aligns GTK, QT, and SDL modules with the active XMODIFIERS framework.

  3. Out-of-the-box experience: New Linux users won't need to struggle with command-line environment configurations to type in their native language.

Wwzyou 2025-12-20 github

After deeper investigation, I found the root cause on my system (Pop!_OS). There was a system-level script located at /etc/profile.d/pop-im-ibus.sh that was forcefully overriding the environment variables to ibus upon login, which neutralized the proposed adaptive script.

Since the issue stems more from specific distribution configurations rather than a general flaw in the Steam launcher, and my proposed script might not be robust enough to counter such system-level overrides, I am closing this request for now.

Thank you for the attention

Launch options