Skip to content

Add super key support for thumb shift mode#46

Open
tychiu wants to merge 1 commit into
ibus:mainfrom
tychiu:thumb-shift-super-key
Open

Add super key support for thumb shift mode#46
tychiu wants to merge 1 commit into
ibus:mainfrom
tychiu:thumb-shift-super-key

Conversation

@tychiu

@tychiu tychiu commented Feb 15, 2026

Copy link
Copy Markdown

Symptom
Given that:

  • typing method is set to thumb shift mode
  • input mode is not set to any Latin mode
  • a text field is in focus
  • Super + Space remains the shortcut for switching to another input method or keyboard layout in IBus

When a user presses Super + Space
Then the user sees a space added to the text field and layout not switched

Expected
Given that:

  • typing method is set to thumb shift mode
  • input mode is not set to any Latin mode
  • a text field is in focus
  • Super + Space remains the shortcut for switching to another input method or keyboard layout in IBus

When a user presses Super + Space
Then the user sees that Anthy is no longer the active IBus Engine

Root Cause
The super key modifier is ignored only in thumb shift mode.

In Thumb Shift Mode (__process_key_event_thumb()):

state = state & (IBus.ModifierType.SHIFT_MASK |
                     IBus.ModifierType.CONTROL_MASK |
                     IBus.ModifierType.MOD1_MASK |
                     IBus.ModifierType.RELEASE_MASK)

In Romaji or Kana Mode (__process_key_event_internal2()):

state = state & (IBus.ModifierType.SHIFT_MASK |
                     IBus.ModifierType.CONTROL_MASK |
                     IBus.ModifierType.MOD1_MASK |
                     IBus.ModifierType.MOD4_MASK)

Solution
Supplement MOD4_MASK to the state usages specific to thumb shift mode.

Remarks
Please let me know if there are practices that I should follow.

@fujiwarat

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds IBus.ModifierType.MOD4_MASK to the state mask and modifier checks in both the Python 2 and Python 3 engines. The feedback suggests removing redundant backslashes (\) used for line continuation inside parentheses in the Python 3 engine to comply with PEP 8 and maintain consistency with the Python 2 implementation.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread engine/python3/engine.py
Comment on lines +1922 to +1924
(IBus.ModifierType.CONTROL_MASK | \
IBus.ModifierType.MOD1_MASK | \
IBus.ModifierType.MOD4_MASK) == 0:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Python, backslashes (\) for line continuation are redundant and discouraged when inside parentheses, as Python implicitly continues lines within parentheses, brackets, and braces (see PEP 8). Removing them also makes the code consistent with the Python 2 engine implementation in engine/python2/engine.py.

Suggested change
(IBus.ModifierType.CONTROL_MASK | \
IBus.ModifierType.MOD1_MASK | \
IBus.ModifierType.MOD4_MASK) == 0:
(IBus.ModifierType.CONTROL_MASK |
IBus.ModifierType.MOD1_MASK |
IBus.ModifierType.MOD4_MASK) == 0:

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.

2 participants