Skip to content

Add super key support for thumb shift mode - #46

Open
tychiu wants to merge 4 commits into
ibus:mainfrom
tychiu:thumb-shift-super-key
Open

Add super key support for thumb shift mode#46
tychiu wants to merge 4 commits 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 Outdated
@tychiu
tychiu force-pushed the thumb-shift-super-key branch from ef50a00 to 4a6ba0c Compare July 4, 2026 09:59
@tychiu

tychiu commented Jul 4, 2026

Copy link
Copy Markdown
Author

Hi Fujiwara-san, I have created a new commit for the backslash removal to keep a record for the original change. If you would prefer to have the commits combined for a cleaner commit trace, please let me know

@fujiwarat

Copy link
Copy Markdown
Member

Thank you for your patch.
I will get time to review your patches later.

@fujiwarat fujiwarat left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wish to consolidate the similar logic between QWERTY Romaji and Thumb Shift modes.

New variables can be added after the ANTHY_CONFIG_PATH variable definition in engine/engine.py

# Shift, Alt and Super keys
ANTHY_NO_OUTPUT_MODIFIERS = (
    IBus.ModifierType.CONTROL_MASK |
    IBus.ModifierType.MOD1_MASK |
    IBus.ModifierType.MOD4_MASK
)
ANTHY_SHORTCUT_MODIFIERS = (
    ANTHY_NO_OUTPUT_MODIFIERS |
    IBus.ModifierType.SHIFT_MASK
)

Also please rebase your patch and append the "Fixes #46" line to your patch description.

Comment thread engine/python2/engine.py Outdated
Comment thread engine/python2/engine.py Outdated
@fujiwarat

Copy link
Copy Markdown
Member

Please click "Resolve conversation" if you resolve the suggestions.

tychiu added a commit to tychiu/ibus-anthy that referenced this pull request Aug 18, 2026
@tychiu
tychiu force-pushed the thumb-shift-super-key branch from 4a6ba0c to 1be576a Compare August 18, 2026 05:12
tychiu added a commit to tychiu/ibus-anthy that referenced this pull request Aug 18, 2026
@tychiu
tychiu force-pushed the thumb-shift-super-key branch from 1be576a to 2cbb3d6 Compare August 18, 2026 05:14
@tychiu

tychiu commented Aug 18, 2026

Copy link
Copy Markdown
Author

Thank you for the suggestion! Please review the latest commit and let me know if there is any other changes you'd like me to make.

tychiu added a commit to tychiu/ibus-anthy that referenced this pull request Aug 18, 2026
@tychiu
tychiu force-pushed the thumb-shift-super-key branch from 34e8c54 to 7cf0c54 Compare August 18, 2026 09:00
tychiu added a commit to tychiu/ibus-anthy that referenced this pull request Aug 18, 2026
@tychiu
tychiu force-pushed the thumb-shift-super-key branch from 7cf0c54 to 1cc05ac Compare August 18, 2026 09:08
@tychiu
tychiu force-pushed the thumb-shift-super-key branch from 1cc05ac to bc65cd3 Compare August 18, 2026 09:09
Comment thread engine/python3/engine.py Outdated
@fujiwarat

Copy link
Copy Markdown
Member

LGTM.
I guess you don't require to update the Python2 code as handling the Super key is needed in the recent GNOME and also Python2 is now EOL.
Currently I think to update Python2 code for the critical bug fixes only to avoid any regressions with the new changes.

@tychiu

tychiu commented Aug 20, 2026

Copy link
Copy Markdown
Author

Sorry, I'm not sure I understand... Just to confirm, may I know if you'd like me to remove the modifier fix itself from Python 2? Or would you prefer that I simply revert the refactoring for the Python 2 engine?

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