Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

feat(vmk): improve app mode menu UI, key bindings, mouse interaction #52

Merged
nhktmdzhg merged 11 commits intonhktmdzhg:devfrom
linux-l10n-vi:main
Feb 16, 2026
Merged

feat(vmk): improve app mode menu UI, key bindings, mouse interaction #52
nhktmdzhg merged 11 commits intonhktmdzhg:devfrom
linux-l10n-vi:main

Conversation

@hthienloc
Copy link

@hthienloc hthienloc commented Feb 15, 2026

Summary

This PR overhauls the App Mode selection menu (~) to improve usability and reliability. It introduces mouse interaction, full keyboard navigation, optimized shortcuts, and fixes a critical issue where text was lost when switching modes.

Changes

UI/UX Improvements

  • feat(mouse): Enabled mouse click support for menu items using AppModeCandidateWord.
  • feat(keyboard): Added navigation support via Arrow Keys and Tab. Use Enter/Space to select.
  • feat(shortcuts): Reorganized mode shortcuts to the QWER row for better one-handed access:
    • q → Preedit
    • w → Emoji
    • e → Off
    • r → Reset Config
  • style: Visual indicator (>>) for the currently active mode.

Bug Fixes

  • fix(core): Implemented commitPendingText to ensure preedit buffer is committed before mode switching or engine reset, preventing data loss.

Motivation

The previous menu was static and required memorizing specific number keys, which was not user-friendly. Additionally, users reported losing their uncommitted text when switching input modes appropriately, interrupting their workflow.

Testing Checklist

  • Mouse clicking on any mode selects it correctly.
  • Keyboard navigation (Up/Down/Tab) works with wrap-around.
  • Typing text in Preedit mode and switching to VMK Smooth preserves the text.
  • Reset App Config (r) correctly clears the saved preference for the current app.

- Mouse Support: Enable mouse click for mode selection in app mode menu.
- Key Bindings: Change aux mode keys from numbers (5-8) to letters (q, w, e, r).
- Menu UI:
  - Update shortcut labels (e.g., [q], [w]).
  - Shorten 'App name detected...' to 'App:'.
  - Use '>>' arrow to indicate active mode.
  - Show Emoji page number.
- Cleanup: Optimize cleanup logic and remove unused variables.
@hthienloc hthienloc changed the title refactor(vmk): improve app mode menu UI and key bindings refactor(vmk): improve app mode menu UI, key bindings, mouse interaction Feb 15, 2026
@hthienloc
Copy link
Author

@nhktmdzhg ông xem qua xem ổn chưa?

@nhktmdzhg
Copy link
Owner

Để rảnh tôi xem, ý tưởng cho vẻ ok, tại lúc tôi làm cái này tìm hiểu bừa chứ chưa đi sâu, cái emoji sau này ngon hơn

- Fixed HIGH: Commit preedit text before clearing buffers in reset()
  * Call EngineCommitPreedit() for Preedit mode finalization
  * Pull and commit remaining text to prevent data loss
  * Ensures text is saved when switching modes without space

- Fixed HIGH: Corrected index mapping after w↔e key binding swap
  * Emoji mode: index 6 (was 7)
  * Off mode: index 7 (was 6)

- Fixed MEDIUM: Removed redundant emoji buffer clears
  * Already cleared by clearAllBuffers()

- Added VMK1/VMKSmooth cases to commitBuffer()
  * Commit pending preedit on focus change

- Enhanced comments and documentation (~30 lines)
  * Strategy explanations for complex logic
  * Edge case documentation (wrap-around, index 0)
  * User scenario examples (tab while typing)
  * Architecture notes (transient modes, IPC)
@hthienloc hthienloc marked this pull request as draft February 16, 2026 03:28
@hthienloc hthienloc force-pushed the main branch 3 times, most recently from 6d2bdc0 to 618d1f9 Compare February 16, 2026 05:27
@hthienloc hthienloc marked this pull request as ready for review February 16, 2026 05:29
@hthienloc hthienloc changed the title refactor(vmk): improve app mode menu UI, key bindings, mouse interaction refactor(core): modularize engine, translate comments & improve app mode menu Feb 16, 2026
@hthienloc
Copy link
Author

Đã test thử dùng ổn. Nhưng do refactor số lượng hơi lớn code nên giờ có lẽ phải tổ chức lại.

[Bug]: Dấu huyền (`) không thể gõ được trên Vscode?

@nhktmdzhg
Copy link
Owner

vãi, nhiều thế :)))

@nhktmdzhg
Copy link
Owner

Mình nghĩ nên fix bug hay sửa, thêm tính năng trước đi, refactor các kiểu từ từ, dù gì nó cũng không ảnh hưởng nhiều đến sử dụng, mà review cũng khoẻ hơn, bạn sửa hàng loạt như này mình cũng khó mà review được, mình cũng không thể review qua loa.

Bonus là lần sau bạn muốn gửi pr thì 1 pr tập trung 1 cái cụ thể thôi, ném nhiều thứ trong 1 pr hơi khoai. Bạn có thể tách ra nhiều branch để gửi nhiều pr, dễ review, còn refactor ra nhiều file các thứ thì mình nghĩ để mình tự làm cũng được, tại cái này thay đổi lớn, mình tự làm dễ kiểm soát hơn là tạo pr thay đổi lớn.

@hthienloc
Copy link
Author

Ngang này mình nghĩ chắc dễ review rồi, cũng khá đủ những điểm đã đề cập phía trên.

@hthienloc hthienloc changed the title refactor(core): modularize engine, translate comments & improve app mode menu refactor(vmk): improve app mode menu UI, key bindings, mouse interaction Feb 16, 2026
@hthienloc hthienloc changed the title refactor(vmk): improve app mode menu UI, key bindings, mouse interaction feat(vmk): improve app mode menu UI, key bindings, mouse interaction Feb 16, 2026
@nhktmdzhg nhktmdzhg merged commit 91279bf into nhktmdzhg:dev Feb 16, 2026
4 checks passed
nhktmdzhg added a commit that referenced this pull request Feb 17, 2026
* feat(vmk): improve app mode menu UI, key bindings, mouse interaction  (#52)

---------

Co-authored-by: Nguyen Hoang Ky <57983253+nhktmdzhg@users.noreply.github.com>

* fix: commit raw string instead of forward grave key

* feat: Change icon to "E" when switch to "Off" mode

* feat: Change icon to 😄 when switch to "Emoji" mode

* fix: add ack for some applications

* fix reset chromium

* fix: duplicate word when use grave key to exit app mode menu

* fix: waitAck don't change when focus to other app

* fix: update translation, menu label, logo, README (#59)

* change translation string

* fix: update app mode menu labels for clarity

* feat: add project logo and update README

* fix: update TOC

* Update translation

---------

Co-authored-by: Loc Huynh <148019203+hthienloc@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants