Skip to content

fix(settings): always show language switch key when toggle is on#144

Open
sfrvn wants to merge 1 commit into
LeanBitLab:mainfrom
sfrvn:fix/language-switch-key-toggle
Open

fix(settings): always show language switch key when toggle is on#144
sfrvn wants to merge 1 commit into
LeanBitLab:mainfrom
sfrvn:fix/language-switch-key-toggle

Conversation

@sfrvn
Copy link
Copy Markdown

@sfrvn sfrvn commented May 25, 2026

Summary

Make the "Language switch key" toggle actually show the key in the common
case (single enabled subtype). Closes #143

Problem

SettingsValues#isLanguageSwitchKeyEnabled() used the behavior preference
(PREF_LANGUAGE_SWITCH_KEY: internal / input_method / both) to decide
visibility. With the default internal behavior, the key is hidden
whenever the user has only one subtype enabled in this IME — i.e. for a
typical freshly-installed user. Turning the toggle on appears to do nothing.

Fix

Removed the behavior-based branches. The key is now shown whenever:

  1. the user has the toggle on, AND
  2. there is anywhere to switch to (any other subtype in this IME OR any
    other enabled IME).

The behavior preference still fully controls tap action — see
LatinIME#switchToNextSubtype() and RichInputMethodManager#canSwitchLanguage(),
both untouched. No regression for users who configured a specific behavior.

Verification

  • isLanguageSwitchKeyEnabled() returns true whenever the toggle is on
    and there is something to switch to. With nothing to switch to (single
    IME, single subtype), it still returns false (avoids a useless key).
  • Single-file change; no public API, resources, or other call sites touched.

Note on upstream

The same code path exists in upstream Helium314/HeliBoard. I verified by
reading the source, not by running their build. Happy to forward this
upstream after it lands here if the maintainers prefer.

The 'Language switch key' toggle silently had no effect when only a
single subtype was enabled, because isLanguageSwitchKeyEnabled() gated
visibility on the *behavior* preference (internal / input_method / both).
For the default 'internal' behavior, the key was hidden whenever the user
had a single LeanType subtype, which is the common case.

The behavior preference should only decide what tapping the key does, not
whether the key is rendered. With this fix, the key is shown whenever the
user explicitly enables the toggle and there is anything to switch to (any
other subtype in this IME or any other enabled IME).
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.

Language switch key toggle has no effect when only one subtype is enabled

1 participant