From b8e1a240c5695322277a67b31057892e3162d744 Mon Sep 17 00:00:00 2001 From: Loc Huynh Date: Fri, 20 Feb 2026 23:11:00 +0700 Subject: [PATCH 1/6] Add backtick menu toggle to settings and update documentation - Introduced a new option to enable/disable the typing mode menu triggered by the backtick key. - Updated README files to reflect the new setting and its usage. --- README.en.md | 2 +- README.md | 9 +++++---- src/lotus-config.h | 5 +++++ src/lotus-engine.cpp | 24 +++++++++++++++++++++++- src/lotus-engine.h | 8 ++++++++ 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/README.en.md b/README.en.md index 5eff06d..445e0f5 100644 --- a/README.en.md +++ b/README.en.md @@ -428,7 +428,7 @@ After logging out and logging in again: ### 2. Typing Mode Menu -In any application, press the **`** key to open the typing mode selection menu, where you can use the mouse or shortcuts to select. +In any application, press the **`** key to open the typing mode selection menu, where you can use the mouse or shortcuts to select. If the backtick shortcut interferes with your workflow (e.g. when writing Markdown code fences), you can turn it off in Lotus' settings using the **Backtick menu** toggle. | Mode | Shortcut | Description | | :-------------------- | :------: | :-------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/README.md b/README.md index 35e290a..d7f2376 100644 --- a/README.md +++ b/README.md @@ -404,8 +404,9 @@ Sau khi đã log out và log in lại: 3. Nhấn mũi tên **<** để thêm nó sang cột bên trái. 4. Apply. -
+
Cấu hình thêm cho Wayland (KDE, Hyprland) + - **KDE Plasma:** _System Settings_ → _Keyboard_ → _Virtual Keyboard_ → Chọn **Fcitx 5**. - **Hyprland:** Thêm dòng sau vào `~/.config/hypr/hyprland.conf`: @@ -413,7 +414,7 @@ Sau khi đã log out và log in lại: permission = fcitx5-lotus-server, keyboard, allow ``` -
+
--- @@ -433,14 +434,14 @@ Sau khi đã log out và log in lại: | **Spell Check** | Bật/tắt kiểm tra lỗi chính tả tiếng Việt. | Bật | | **Macro** | Bật/tắt gõ tắt. | Bật | | **Capitalize Macro** | Bật/tắt gõ tắt chữ hoa. | Bật | -| **Auto non-VN restore** | Bât/tắt tự động khôi phục với từ không phải tiếng Việt. | Bật | +| **Auto non-VN restore** | Bật/tắt tự động khôi phục với từ không phải tiếng Việt. | Bật | | **Modern Style** | Bật/tắt kiểu đặt dấu thanh hiện đại *(ví dụ: oà, _uý thay vì òa, _úy)*. | Bật | | **Free Marking** | Bật/tắt bỏ dấu tự do. | Bật | | **Fix Uinput with ack** | Bật/tắt sửa lỗi chế độ `uinput` với ack
Nên bật khi sử dụng các ứng dụng Chromium (Chrome, Brave, Edge, ...). | Tắt | ### 2. Menu chuyển chế độ gõ -Khi đang ở trong bất kỳ ứng dụng nào, nhấn phím **`** để mở menu chọn chế độ gõ, có thể dùng chuột hoặc phím tắt để chọn. +Khi đang ở trong bất kỳ ứng dụng nào, nhấn phím **`** để mở menu chọn chế độ gõ, có thể dùng chuột hoặc phím tắt để chọn. Nếu dieu nay gây khó chịu (ví dụ khi viết mã Markdown), bạn có thể tắt tiện ích này trong cài đặt Lotus bằng công tắc **Backtick menu**. | Chế độ | Phím tắt | Mô tả | |:--------------------- |:--------:|:------------------------------------------------------------------------------------------------------------------------------------ | diff --git a/src/lotus-config.h b/src/lotus-config.h index d3ce0b4..adfd7f1 100644 --- a/src/lotus-config.h +++ b/src/lotus-config.h @@ -208,6 +208,11 @@ namespace fcitx { Option modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true}; Option freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true}; Option fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false}; + /* New boolean to allow users to disable or enable the mode-selection menu + that is triggered by pressing the backtick/grave (`) key. This makes it + easy to avoid conflicts when typing Markdown code fences or other + situations where ` is frequently used. */ + Option backtickMenu{this, "BacktickMenu", _("Enable typing mode menu with ` key"), true}; SubConfigOption customKeymap{this, "CustomKeymap", _("Custom Keymap"), "fcitx://config/addon/lotus/custom_keymap"};); } // namespace fcitx diff --git a/src/lotus-engine.cpp b/src/lotus-engine.cpp index be1007e..3acecac 100644 --- a/src/lotus-engine.cpp +++ b/src/lotus-engine.cpp @@ -261,6 +261,19 @@ namespace fcitx { })); uiManager.registerAction("lotus-fixuinputwithack", fixUinputWithAckAction_.get()); + /* backtick menu toggle */ + backtickMenuAction_ = std::make_unique(); + backtickMenuAction_->setLongText(_("Enable typing mode menu with ` key")); + backtickMenuAction_->setIcon("input-keyboard"); + backtickMenuAction_->setCheckable(true); + connections_.emplace_back(backtickMenuAction_->connect([this](InputContext* ic) { + config_.backtickMenu.setValue(!*config_.backtickMenu); + saveConfig(); + /* nothing to refresh besides UI state */ + updateBacktickMenuAction(ic); + })); + uiManager.registerAction("lotus-backtickmenu", backtickMenuAction_.get()); + reloadConfig(); globalMode_ = modeStringToEnum(config_.mode.value()); updateModeAction(nullptr); @@ -329,6 +342,7 @@ namespace fcitx { updateModernStyleAction(nullptr); updateFreeMarkingAction(nullptr); updateFixUinputWithAckAction(nullptr); + updateBacktickMenuAction(nullptr); } void LotusEngine::setSubConfig(const std::string& path, const RawConfig& config) { @@ -562,7 +576,7 @@ namespace fcitx { return; } - if (!keyEvent.isRelease() && keyEvent.rawKey().check(FcitxKey_grave)) { + if (!keyEvent.isRelease() && keyEvent.rawKey().check(FcitxKey_grave) && *config_.backtickMenu) { currentConfigureApp_ = ic->program(); if (currentConfigureApp_.empty()) currentConfigureApp_ = "unknown-app"; @@ -731,6 +745,14 @@ namespace fcitx { } } + void LotusEngine::updateBacktickMenuAction(InputContext* ic) { + backtickMenuAction_->setChecked(*config_.backtickMenu); + backtickMenuAction_->setShortText(*config_.backtickMenu ? _("Backtick menu: On") : _("Backtick menu: Off")); + if (ic) { + backtickMenuAction_->update(ic); + } + } + void LotusEngine::loadAppRules() { appRules_.clear(); std::ifstream file(appRulesPath_); diff --git a/src/lotus-engine.h b/src/lotus-engine.h index fd134be..2210cd8 100644 --- a/src/lotus-engine.h +++ b/src/lotus-engine.h @@ -234,6 +234,12 @@ namespace fcitx { */ void updateFixUinputWithAckAction(InputContext* ic); + /** + * @brief Updates the backtick-menu toggle UI. + * @param ic Current input context. + */ + void updateBacktickMenuAction(InputContext* ic); + /** * @brief Updates the input method action UI. * @param ic Current input context. @@ -315,6 +321,8 @@ namespace fcitx { std::unique_ptr modernStyleAction_; std::unique_ptr freeMarkingAction_; std::unique_ptr fixUinputWithAckAction_; + /* toggle for the backtick-triggered mode menu */ + std::unique_ptr backtickMenuAction_; std::vector connections_; CGoObject dictionary_; std::unordered_map appRules_; From 6b90591b05c32d72ecbfdb711f82a52d0f94a847 Mon Sep 17 00:00:00 2001 From: Loc Huynh Date: Fri, 20 Feb 2026 23:14:53 +0700 Subject: [PATCH 2/6] clang-format --- src/lotus-config.h | 10 +++++----- src/lotus-engine.h | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lotus-config.h b/src/lotus-config.h index adfd7f1..014e6d2 100644 --- a/src/lotus-config.h +++ b/src/lotus-config.h @@ -204,15 +204,15 @@ namespace fcitx { OptionWithAnnotation outputCharset{this, "OutputCharset", _("Output Charset"), "Unicode", {}, {}, StringListAnnotation()}; Option spellCheck{this, "SpellCheck", _("Enable spell check"), true}; Option macro{this, "Macro", _("Enable Macro"), true}; Option capitalizeMacro{this, "CapitalizeMacro", _("Capitalize Macro"), true}; - Option autoNonVnRestore{this, "AutoNonVnRestore", _("Auto restore keys with invalid words"), true}; - Option modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true}; - Option freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true}; - Option fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false}; + Option autoNonVnRestore{this, "AutoNonVnRestore", _("Auto restore keys with invalid words"), true}; + Option modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true}; + Option freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true}; + Option fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false}; /* New boolean to allow users to disable or enable the mode-selection menu that is triggered by pressing the backtick/grave (`) key. This makes it easy to avoid conflicts when typing Markdown code fences or other situations where ` is frequently used. */ - Option backtickMenu{this, "BacktickMenu", _("Enable typing mode menu with ` key"), true}; + Option backtickMenu{this, "BacktickMenu", _("Enable typing mode menu with ` key"), true}; SubConfigOption customKeymap{this, "CustomKeymap", _("Custom Keymap"), "fcitx://config/addon/lotus/custom_keymap"};); } // namespace fcitx diff --git a/src/lotus-engine.h b/src/lotus-engine.h index 2210cd8..2016e39 100644 --- a/src/lotus-engine.h +++ b/src/lotus-engine.h @@ -322,15 +322,15 @@ namespace fcitx { std::unique_ptr freeMarkingAction_; std::unique_ptr fixUinputWithAckAction_; /* toggle for the backtick-triggered mode menu */ - std::unique_ptr backtickMenuAction_; - std::vector connections_; - CGoObject dictionary_; - std::unordered_map appRules_; - std::string appRulesPath_; - bool isSelectingAppMode_ = false; - std::string currentConfigureApp_; - LotusMode globalMode_; - EmojiLoader emojiLoader_; + std::unique_ptr backtickMenuAction_; + std::vector connections_; + CGoObject dictionary_; + std::unordered_map appRules_; + std::string appRulesPath_; + bool isSelectingAppMode_ = false; + std::string currentConfigureApp_; + LotusMode globalMode_; + EmojiLoader emojiLoader_; }; /** From 6bb29692d06d166d4b4998ba37b82065a1b395be Mon Sep 17 00:00:00 2001 From: Loc Huynh Date: Sat, 21 Feb 2026 02:02:18 +0700 Subject: [PATCH 3/6] refactor: backtick menu to mode menu in configuration and documentation --- README.en.md | 4 ++-- README.md | 3 ++- src/lotus-config.h | 14 +++++--------- src/lotus-engine.cpp | 30 ++++++++++++++---------------- src/lotus-engine.h | 23 +++++++++++------------ 5 files changed, 34 insertions(+), 40 deletions(-) diff --git a/README.en.md b/README.en.md index 445e0f5..de0b3f8 100644 --- a/README.en.md +++ b/README.en.md @@ -424,11 +424,11 @@ After logging out and logging in again: ### 1. Customize Input Method - **How to access:** Right-click the Lotus icon on the system tray to open customization. -- **Customization options:** _Typing Mode_, _Input Method_, _Charset_, _Spell Check_, _Macro_, _Capitalize Macro_, _Auto non-VN restore_, _Modern Style_, _Free Marking_, _Fix Uinput with ack_. +- **Customization options:** _Typing Mode_, _Input Method_, _Charset_, _Spell Check_, _Macro_, _Capitalize Macro_, _Auto non-VN restore_, _Modern Style_, _Free Marking_, _Fix Uinput with ack_, _Mode menu_. ### 2. Typing Mode Menu -In any application, press the **`** key to open the typing mode selection menu, where you can use the mouse or shortcuts to select. If the backtick shortcut interferes with your workflow (e.g. when writing Markdown code fences), you can turn it off in Lotus' settings using the **Backtick menu** toggle. +In any application, press the **`** key to open the typing mode selection menu, where you can use the mouse or shortcuts to select. If the backtick shortcut interferes with your workflow (e.g. when writing Markdown code fences), you can turn it off in Lotus' settings using the **Mode menu** toggle. | Mode | Shortcut | Description | | :-------------------- | :------: | :-------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/README.md b/README.md index d7f2376..7e82971 100644 --- a/README.md +++ b/README.md @@ -438,10 +438,11 @@ Sau khi đã log out và log in lại: | **Modern Style** | Bật/tắt kiểu đặt dấu thanh hiện đại *(ví dụ: oà, _uý thay vì òa, _úy)*. | Bật | | **Free Marking** | Bật/tắt bỏ dấu tự do. | Bật | | **Fix Uinput with ack** | Bật/tắt sửa lỗi chế độ `uinput` với ack
Nên bật khi sử dụng các ứng dụng Chromium (Chrome, Brave, Edge, ...). | Tắt | +| **Mode Menu** | Bật/tắt mở menu chuyển chế độ gõ bằng phím **`** (tắt để nhập biểu tượng trực tiếp). | Bật | ### 2. Menu chuyển chế độ gõ -Khi đang ở trong bất kỳ ứng dụng nào, nhấn phím **`** để mở menu chọn chế độ gõ, có thể dùng chuột hoặc phím tắt để chọn. Nếu dieu nay gây khó chịu (ví dụ khi viết mã Markdown), bạn có thể tắt tiện ích này trong cài đặt Lotus bằng công tắc **Backtick menu**. +Khi đang ở trong bất kỳ ứng dụng nào, nhấn phím **`** để mở menu chọn chế độ gõ, có thể dùng chuột hoặc phím tắt để chọn. Nếu điều này gây khó chịu (ví dụ khi viết mã Markdown), bạn có thể tắt menu chế độ trong cài đặt Lotus bằng công tắc **Mode menu**. | Chế độ | Phím tắt | Mô tả | |:--------------------- |:--------:|:------------------------------------------------------------------------------------------------------------------------------------ | diff --git a/src/lotus-config.h b/src/lotus-config.h index 014e6d2..4f76219 100644 --- a/src/lotus-config.h +++ b/src/lotus-config.h @@ -204,15 +204,11 @@ namespace fcitx { OptionWithAnnotation outputCharset{this, "OutputCharset", _("Output Charset"), "Unicode", {}, {}, StringListAnnotation()}; Option spellCheck{this, "SpellCheck", _("Enable spell check"), true}; Option macro{this, "Macro", _("Enable Macro"), true}; Option capitalizeMacro{this, "CapitalizeMacro", _("Capitalize Macro"), true}; - Option autoNonVnRestore{this, "AutoNonVnRestore", _("Auto restore keys with invalid words"), true}; - Option modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true}; - Option freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true}; - Option fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false}; - /* New boolean to allow users to disable or enable the mode-selection menu - that is triggered by pressing the backtick/grave (`) key. This makes it - easy to avoid conflicts when typing Markdown code fences or other - situations where ` is frequently used. */ - Option backtickMenu{this, "BacktickMenu", _("Enable typing mode menu with ` key"), true}; + Option autoNonVnRestore{this, "AutoNonVnRestore", _("Auto restore keys with invalid words"), true}; + Option modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true}; + Option freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true}; + Option fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false}; + Option modeMenu{this, "ModeMenu", _("Open typing mode menu with ` key"), true}; SubConfigOption customKeymap{this, "CustomKeymap", _("Custom Keymap"), "fcitx://config/addon/lotus/custom_keymap"};); } // namespace fcitx diff --git a/src/lotus-engine.cpp b/src/lotus-engine.cpp index 3acecac..a93bd94 100644 --- a/src/lotus-engine.cpp +++ b/src/lotus-engine.cpp @@ -261,18 +261,16 @@ namespace fcitx { })); uiManager.registerAction("lotus-fixuinputwithack", fixUinputWithAckAction_.get()); - /* backtick menu toggle */ - backtickMenuAction_ = std::make_unique(); - backtickMenuAction_->setLongText(_("Enable typing mode menu with ` key")); - backtickMenuAction_->setIcon("input-keyboard"); - backtickMenuAction_->setCheckable(true); - connections_.emplace_back(backtickMenuAction_->connect([this](InputContext* ic) { - config_.backtickMenu.setValue(!*config_.backtickMenu); + modeMenuAction_ = std::make_unique(); + modeMenuAction_->setLongText(_("Enable typing mode menu")); + modeMenuAction_->setIcon("input-keyboard"); + modeMenuAction_->setCheckable(true); + connections_.emplace_back(modeMenuAction_->connect([this](InputContext* ic) { + config_.modeMenu.setValue(!*config_.modeMenu); saveConfig(); - /* nothing to refresh besides UI state */ - updateBacktickMenuAction(ic); + updateModeMenuAction(ic); })); - uiManager.registerAction("lotus-backtickmenu", backtickMenuAction_.get()); + uiManager.registerAction("lotus-modemenu", modeMenuAction_.get()); reloadConfig(); globalMode_ = modeStringToEnum(config_.mode.value()); @@ -342,7 +340,7 @@ namespace fcitx { updateModernStyleAction(nullptr); updateFreeMarkingAction(nullptr); updateFixUinputWithAckAction(nullptr); - updateBacktickMenuAction(nullptr); + updateModeMenuAction(nullptr); } void LotusEngine::setSubConfig(const std::string& path, const RawConfig& config) { @@ -576,7 +574,7 @@ namespace fcitx { return; } - if (!keyEvent.isRelease() && keyEvent.rawKey().check(FcitxKey_grave) && *config_.backtickMenu) { + if (!keyEvent.isRelease() && keyEvent.rawKey().check(FcitxKey_grave) && *config_.modeMenu) { currentConfigureApp_ = ic->program(); if (currentConfigureApp_.empty()) currentConfigureApp_ = "unknown-app"; @@ -745,11 +743,11 @@ namespace fcitx { } } - void LotusEngine::updateBacktickMenuAction(InputContext* ic) { - backtickMenuAction_->setChecked(*config_.backtickMenu); - backtickMenuAction_->setShortText(*config_.backtickMenu ? _("Backtick menu: On") : _("Backtick menu: Off")); + void LotusEngine::updateModeMenuAction(InputContext* ic) { + modeMenuAction_->setChecked(*config_.modeMenu); + modeMenuAction_->setShortText(*config_.modeMenu ? _("Mode menu: On") : _("Mode menu: Off")); if (ic) { - backtickMenuAction_->update(ic); + modeMenuAction_->update(ic); } } diff --git a/src/lotus-engine.h b/src/lotus-engine.h index 2016e39..33a91ed 100644 --- a/src/lotus-engine.h +++ b/src/lotus-engine.h @@ -235,10 +235,10 @@ namespace fcitx { void updateFixUinputWithAckAction(InputContext* ic); /** - * @brief Updates the backtick-menu toggle UI. + * @brief Updates the mode-menu action UI. * @param ic Current input context. */ - void updateBacktickMenuAction(InputContext* ic); + void updateModeMenuAction(InputContext* ic); /** * @brief Updates the input method action UI. @@ -321,16 +321,15 @@ namespace fcitx { std::unique_ptr modernStyleAction_; std::unique_ptr freeMarkingAction_; std::unique_ptr fixUinputWithAckAction_; - /* toggle for the backtick-triggered mode menu */ - std::unique_ptr backtickMenuAction_; - std::vector connections_; - CGoObject dictionary_; - std::unordered_map appRules_; - std::string appRulesPath_; - bool isSelectingAppMode_ = false; - std::string currentConfigureApp_; - LotusMode globalMode_; - EmojiLoader emojiLoader_; + std::unique_ptr modeMenuAction_; + std::vector connections_; + CGoObject dictionary_; + std::unordered_map appRules_; + std::string appRulesPath_; + bool isSelectingAppMode_ = false; + std::string currentConfigureApp_; + LotusMode globalMode_; + EmojiLoader emojiLoader_; }; /** From 559139786148eb660ca280c41de432f48841bd7a Mon Sep 17 00:00:00 2001 From: Loc Huynh Date: Sat, 21 Feb 2026 02:23:57 +0700 Subject: [PATCH 4/6] fix: clean up formatting and improve clarity in README sections --- README.en.md | 16 ++++--- README.md | 118 ++++++++++++++++++++++++++------------------------- 2 files changed, 70 insertions(+), 64 deletions(-) diff --git a/README.en.md b/README.en.md index de0b3f8..3d3e4dc 100644 --- a/README.en.md +++ b/README.en.md @@ -294,6 +294,7 @@ After installation, you need to follow these steps to enable the fcitx5-lotus in The server helps the input method interact better with the system (especially sending backspace and fixing errors). - **Bash / Zsh:** + ```bash # Enable and start the service (automatically fixes missing systemd user errors if any) sudo systemctl enable --now fcitx5-lotus-server@$(whoami).service || \ @@ -301,6 +302,7 @@ sudo systemctl enable --now fcitx5-lotus-server@$(whoami).service || \ ``` - **Fish shell:** + ```fish # Enable and start the service (automatically fixes missing systemd user errors if any) sudo systemctl enable --now fcitx5-lotus-server@(whoami).service; or begin @@ -308,7 +310,6 @@ sudo systemctl enable --now fcitx5-lotus-server@(whoami).service; or begin end ``` - ```bash # Check status (if you see green active (running), it's OK) systemctl status fcitx5-lotus-server@$(whoami).service @@ -319,6 +320,7 @@ systemctl status fcitx5-lotus-server@$(whoami).service The input method will not work without these variables. - **Bash / Zsh:** + ```bash # This command will add the configuration to ~/.bash_profile, do the same for .zprofile cat <> ~/.bash_profile @@ -331,6 +333,7 @@ EOF ``` - **Fish shell:** + ```fish # Add configuration to ~/.config/fish/config.fish cat >> ~/.config/fish/config.fish <<'EOF' @@ -344,7 +347,6 @@ set -gx GLFW_IM_MODULE ibus EOF ``` - Log out and log in to apply changes.
@@ -419,16 +421,16 @@ After logging out and logging in again: -## 📖 Usage Guide +## 📖 Usage guide -### 1. Customize Input Method +### 1. Customize input method -- **How to access:** Right-click the Lotus icon on the system tray to open customization. +- **Access:** Right-click the Lotus icon on the system tray to open customization. - **Customization options:** _Typing Mode_, _Input Method_, _Charset_, _Spell Check_, _Macro_, _Capitalize Macro_, _Auto non-VN restore_, _Modern Style_, _Free Marking_, _Fix Uinput with ack_, _Mode menu_. -### 2. Typing Mode Menu +### 2. Typing mode menu -In any application, press the **`** key to open the typing mode selection menu, where you can use the mouse or shortcuts to select. If the backtick shortcut interferes with your workflow (e.g. when writing Markdown code fences), you can turn it off in Lotus' settings using the **Mode menu** toggle. +In any application, press the **`** key to open the typing mode selection menu, where you can use the mouse or shortcuts to select. If the backtick shortcut interferes with your workflow (e.g. when writing Markdown code fences), you can turn it off in Lotus' settings using the **Mode menu** toggle. | Mode | Shortcut | Description | | :-------------------- | :------: | :-------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/README.md b/README.md index 7e82971..d1cb92d 100644 --- a/README.md +++ b/README.md @@ -45,84 +45,84 @@ Dự án này là bản fork được tối ưu hóa từ [bộ gõ VMK](https://github.com/thanhpy2009/VMK). Chân thành cảm ơn tác giả Thành đã đặt nền móng cho bộ gõ này. > **Lưu ý:** Gỡ và xoá cấu hình `fcitx5-vmk` trước khi cài đặt `fcitx5-lotus` để tránh phát sinh lỗi. -> +> >
> Gỡ và xoá cấu hình fcitx5-vmk -> +> >
> Arch / Arch-based - AUR >
-> +> > Bạn có thể dùng `pacman` (khuyên dùng), `yay` hoặc `paru` để gỡ cài đặt: -> +> > ```bash > sudo pacman -Rns fcitx5-vmk > ``` -> +> > ```bash > yay -Rns fcitx5-vmk > ``` -> +> > ```bash > paru -Rns fcitx5-vmk > ``` -> +> > > **Lưu ý:** Các file config ở `$HOME` sẽ được giữ lại. -> +> >
-> +> >
> Debian / Ubuntu / Fedora / openSUSE - Open Build Service >
-> +> > - Debian/Ubuntu -> +> > ```bash > sudo apt remove fcitx5-vmk > ``` -> +> > - Fedora -> +> > ```bash > sudo dnf remove fcitx5-vmk > ``` -> +> > - openSUSE -> +> > ```bash > sudo zypper remove fcitx5-vmk > ``` -> +> >
-> +> >
> NixOS >
-> +> > Xóa (hoặc comment) dòng `services.fcitx5-vmk` và `inputs` trong file config, sau đó rebuild lại system. NixOS sẽ tự dọn dẹp. -> +> >
-> +> >
> Biên dịch từ nguồn >
-> +> > Vào lại thư mục source code đã build và chạy: -> +> > ```bash > sudo make uninstall > ``` -> +> >
-> +> > --- -> +> > Xóa cấu hình `vmk` không tương thích: -> +> > ```bash > rm ~/.config/fcitx5/conf/vmk-*.conf > ``` -> +> >
@@ -236,9 +236,9 @@ Rebuild lại system để cài đặt.
> **KHUYẾN CÁO QUAN TRỌNG:** -> +> > Vui lòng **KHÔNG** sử dụng cách này nếu distro của bạn đã được hỗ trợ thông qua **Open Build Service**. -> +> > Việc biên dịch thủ công đòi hỏi bạn phải hiểu rõ về cấu trúc thư mục của hệ thống. Nếu bạn gặp lỗi "Not Available" hoặc thiếu thư viện khi cài theo cách này trên các distro phổ biến (Ubuntu/Fedora...), hãy quay lại dùng Open Build Service để đảm bảo tính ổn định và tự động cập nhật. ##### Yêu cầu hệ thống @@ -294,6 +294,7 @@ Sau khi cài đặt xong, bạn cần thực hiện các bước sau để bật Server giúp bộ gõ tương tác với hệ thống tốt hơn (đặc biệt là gửi phím xóa và sửa lỗi). - **Bash / Zsh:** + ```bash # Bật và khởi động service (tự động fix lỗi thiếu user systemd nếu có) sudo systemctl enable --now fcitx5-lotus-server@$(whoami).service || \ @@ -301,6 +302,7 @@ sudo systemctl enable --now fcitx5-lotus-server@$(whoami).service || \ ``` - **Fish shell:** + ```fish # Bật và khởi động service (tự động fix lỗi thiếu user systemd nếu có) sudo systemctl enable --now fcitx5-lotus-server@(whoami).service; or begin @@ -318,6 +320,7 @@ systemctl status fcitx5-lotus-server@$(whoami).service Bộ gõ sẽ không hoạt động nếu thiếu các biến này. - **Bash / Zsh:** + ```bash # Thêm cấu hình vào ~/.bash_profile (với .zprofile làm tương tự) cat <> ~/.bash_profile @@ -330,6 +333,7 @@ EOF ``` - **Fish shell:** + ```fish # Thêm cấu hình vào ~/.config/fish/config.fish cat >> ~/.config/fish/config.fish <<'EOF' @@ -378,7 +382,7 @@ killall ibus-daemon || ibus exit Thêm Fcitx5 vào Autostart cho từng DE / WM (GNOME, Hyprland ...) | DE / WM | Hướng dẫn chi tiết | -|:-------------- |:---------------------------------------------------------------------------------------------------------------------------- | +| :------------- | :--------------------------------------------------------------------------------------------------------------------------- | | **GNOME** | _GNOME Tweaks_ → _Startup Applications_ → Add → `Fcitx 5` | | **KDE Plasma** | _System Settings_ → _Autostart_ → Add... → Add Application... → `Fcitx 5` | | **Xfce** | _Settings_ → _Session and Startup_ → _Application Autostart_ → Add → `Fcitx 5` | @@ -403,7 +407,7 @@ Sau khi đã log out và log in lại: 2. Tìm **Lotus** ở cột bên phải. 3. Nhấn mũi tên **<** để thêm nó sang cột bên trái. 4. Apply. - +
Cấu hình thêm cho Wayland (KDE, Hyprland) @@ -424,37 +428,37 @@ Sau khi đã log out và log in lại: ### 1. Tùy chỉnh bộ gõ -- **Cách truy cập:** Nhấp chuột phải vào biểu tượng Lotus trên system tray để mở tuỳ chỉnh. - -| Tùy chọn | Mô tả | Mặc định | -|:----------------------- |:----------------------------------------------------------------------------------------------------------------- |:--------------- | -| **Typing Mode** | Chọn chế độ gõ. | Uinput (Smooth) | -| **Input Method** | Chọn kiểu gõ. | Telex | -| **Charset** | Chọn bảng mã. | Unicode | -| **Spell Check** | Bật/tắt kiểm tra lỗi chính tả tiếng Việt. | Bật | -| **Macro** | Bật/tắt gõ tắt. | Bật | -| **Capitalize Macro** | Bật/tắt gõ tắt chữ hoa. | Bật | -| **Auto non-VN restore** | Bật/tắt tự động khôi phục với từ không phải tiếng Việt. | Bật | -| **Modern Style** | Bật/tắt kiểu đặt dấu thanh hiện đại *(ví dụ: oà, _uý thay vì òa, _úy)*. | Bật | -| **Free Marking** | Bật/tắt bỏ dấu tự do. | Bật | -| **Fix Uinput with ack** | Bật/tắt sửa lỗi chế độ `uinput` với ack
Nên bật khi sử dụng các ứng dụng Chromium (Chrome, Brave, Edge, ...). | Tắt | -| **Mode Menu** | Bật/tắt mở menu chuyển chế độ gõ bằng phím **`** (tắt để nhập biểu tượng trực tiếp). | Bật | +- **Truy cập:** Nhấp chuột phải vào biểu tượng Lotus trên system tray để mở tuỳ chỉnh. + +| Tùy chọn | Mô tả | Mặc định | +| :---------------------- | :--------------------------------------------------------------------------------------------------------------- | :-------------- | +| **Typing Mode** | Chọn chế độ gõ. | Uinput (Smooth) | +| **Input Method** | Chọn kiểu gõ. | Telex | +| **Charset** | Chọn bảng mã. | Unicode | +| **Spell Check** | Bật/tắt kiểm tra lỗi chính tả tiếng Việt. | Bật | +| **Macro** | Bật/tắt gõ tắt. | Bật | +| **Capitalize Macro** | Bật/tắt gõ tắt chữ hoa. | Bật | +| **Auto non-VN restore** | Bật/tắt tự động khôi phục với từ không phải tiếng Việt. | Bật | +| **Modern Style** | Bật/tắt kiểu đặt dấu thanh hiện đại _(ví dụ: oà, *uý thay vì òa, *úy)_. | Bật | +| **Free Marking** | Bật/tắt bỏ dấu tự do. | Bật | +| **Fix Uinput with ack** | Bật/tắt sửa lỗi chế độ Uinput với ack.
Nên bật khi sử dụng các ứng dụng Chromium (Chrome, Brave, Edge, ...). | Tắt | +| **Mode Menu** | Bật/tắt mở menu chuyển chế độ gõ bằng phím **`** (tắt để nhập biểu tượng trực tiếp). | Bật | ### 2. Menu chuyển chế độ gõ -Khi đang ở trong bất kỳ ứng dụng nào, nhấn phím **`** để mở menu chọn chế độ gõ, có thể dùng chuột hoặc phím tắt để chọn. Nếu điều này gây khó chịu (ví dụ khi viết mã Markdown), bạn có thể tắt menu chế độ trong cài đặt Lotus bằng công tắc **Mode menu**. +Khi con trỏ đang ở trong ô nhập liệu (có thể gõ văn bản), nhấn phím **`** để mở menu chọn chế độ gõ; bạn có thể dùng chuột hoặc phím tắt để chọn. | Chế độ | Phím tắt | Mô tả | -|:--------------------- |:--------:|:------------------------------------------------------------------------------------------------------------------------------------ | -| **Uinput (Smooth)** | **1** | Chế độ mặc định, phản hồi nhanh.
**Tối ưu:** ứng dụng có tốc độ xử lý input cao. | -| **Uinput (Slow)** | **2** | Tương tự Uinput (Smooth) nhưng tốc độ gửi phím chậm hơn.
**Tối ưu:** ứng dụng có tốc độ xử lý input thấp _(ví dụ: Libre Office)_. | -| **Uinput (Hardcore)** | **3** | Biến thể của Uinput (Smooth).
**Tối ưu:** ứng dụng Windows qua Wine. | -| **Surrounding Text** | **4** | Cho phép sửa dấu trên văn bản đã gõ, hoạt động mượt.
**Tối ưu:** ứng dụng Qt/GTK. | -| **Preedit** | **Q** | Hiển thị gạch chân khi gõ.
**Tối ưu:** hầu hết ứng dụng. | -| **Emoji Picker** | **W** | Tìm kiếm và nhập Emoji (nguồn EmojiOne, hỗ trợ fuzzy search). | -| **OFF** | **E** | Tắt bộ gõ. | -| **Default Typing** | **R** | Chế độ gõ mặc định được cấu hình tại tuỳ chọn _Typing mode_. | -| **Type `** | **`** | Nhập ký tự **`**. | +| :-------------------- | :------: | :----------------------------------------------------------------------------------------------------------------------------------- | +| **Uinput (Smooth)** | **1** | Chế độ mặc định, phản hồi nhanh.
**Tối ưu:** ứng dụng có tốc độ xử lý input cao. | +| **Uinput (Slow)** | **2** | Tương tự Uinput (Smooth) nhưng tốc độ gửi phím chậm hơn.
**Tối ưu:** ứng dụng có tốc độ xử lý input thấp _(ví dụ: Libre Office)_. | +| **Uinput (Hardcore)** | **3** | Biến thể của Uinput (Smooth).
**Tối ưu:** ứng dụng Windows qua Wine. | +| **Surrounding Text** | **4** | Cho phép sửa dấu trên văn bản đã gõ, hoạt động mượt.
**Tối ưu:** ứng dụng Qt/GTK. | +| **Preedit** | **Q** | Hiển thị gạch chân khi gõ.
**Tối ưu:** hầu hết ứng dụng. | +| **Emoji Picker** | **W** | Tìm kiếm và nhập Emoji (nguồn EmojiOne, hỗ trợ fuzzy search). | +| **OFF** | **E** | Tắt bộ gõ. | +| **Default Typing** | **R** | Chế độ gõ mặc định được cấu hình tại tuỳ chọn _Typing mode_. | +| **Type `** | **`** | Nhập ký tự **`**. | Bộ gõ sẽ tự động lưu chế độ gõ đã dùng gần nhất cho từng ứng dụng và khôi phục cấu hình đó khi bạn mở lại chúng. From 1f029bb5d073ba85b7b66ed2ac5070c5c6f60696 Mon Sep 17 00:00:00 2001 From: Loc Huynh Date: Sat, 21 Feb 2026 08:30:25 +0700 Subject: [PATCH 5/6] refactor: rename mode menu action to typing mode menu action for clarity --- src/lotus-engine.cpp | 24 ++++++++++++------------ src/lotus-engine.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/lotus-engine.cpp b/src/lotus-engine.cpp index a93bd94..41590bd 100644 --- a/src/lotus-engine.cpp +++ b/src/lotus-engine.cpp @@ -261,16 +261,16 @@ namespace fcitx { })); uiManager.registerAction("lotus-fixuinputwithack", fixUinputWithAckAction_.get()); - modeMenuAction_ = std::make_unique(); - modeMenuAction_->setLongText(_("Enable typing mode menu")); - modeMenuAction_->setIcon("input-keyboard"); - modeMenuAction_->setCheckable(true); - connections_.emplace_back(modeMenuAction_->connect([this](InputContext* ic) { + typingModeMenuAction_ = std::make_unique(); + typingModeMenuAction_->setLongText(_("Open typing mode menu")); + typingModeMenuAction_->setIcon("input-keyboard"); + typingModeMenuAction_->setCheckable(true); + connections_.emplace_back(typingModeMenuAction_->connect([this](InputContext* ic) { config_.modeMenu.setValue(!*config_.modeMenu); saveConfig(); - updateModeMenuAction(ic); + updateTypingModeMenuAction(ic); })); - uiManager.registerAction("lotus-modemenu", modeMenuAction_.get()); + uiManager.registerAction("lotus-modemenu", typingModeMenuAction_.get()); reloadConfig(); globalMode_ = modeStringToEnum(config_.mode.value()); @@ -340,7 +340,7 @@ namespace fcitx { updateModernStyleAction(nullptr); updateFreeMarkingAction(nullptr); updateFixUinputWithAckAction(nullptr); - updateModeMenuAction(nullptr); + updateTypingModeMenuAction(nullptr); } void LotusEngine::setSubConfig(const std::string& path, const RawConfig& config) { @@ -743,11 +743,11 @@ namespace fcitx { } } - void LotusEngine::updateModeMenuAction(InputContext* ic) { - modeMenuAction_->setChecked(*config_.modeMenu); - modeMenuAction_->setShortText(*config_.modeMenu ? _("Mode menu: On") : _("Mode menu: Off")); + void LotusEngine::updateTypingModeMenuAction(InputContext* ic) { + typingModeMenuAction_->setChecked(*config_.modeMenu); + typingModeMenuAction_->setShortText(*config_.modeMenu ? _("Typing Mode Menu: On") : _("Typing Mode Menu: Off")); if (ic) { - modeMenuAction_->update(ic); + typingModeMenuAction_->update(ic); } } diff --git a/src/lotus-engine.h b/src/lotus-engine.h index 33a91ed..e219663 100644 --- a/src/lotus-engine.h +++ b/src/lotus-engine.h @@ -238,7 +238,7 @@ namespace fcitx { * @brief Updates the mode-menu action UI. * @param ic Current input context. */ - void updateModeMenuAction(InputContext* ic); + void updateTypingModeMenuAction(InputContext* ic); /** * @brief Updates the input method action UI. @@ -321,7 +321,7 @@ namespace fcitx { std::unique_ptr modernStyleAction_; std::unique_ptr freeMarkingAction_; std::unique_ptr fixUinputWithAckAction_; - std::unique_ptr modeMenuAction_; + std::unique_ptr typingModeMenuAction_; std::vector connections_; CGoObject dictionary_; std::unordered_map appRules_; From 6dbe308e63b876bf845eef62966c56042c1e7c30 Mon Sep 17 00:00:00 2001 From: Loc Huynh Date: Sat, 21 Feb 2026 09:47:57 +0700 Subject: [PATCH 6/6] feat: add typing mode menu action to status area --- src/lotus-engine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lotus-engine.cpp b/src/lotus-engine.cpp index 41590bd..8db3c4a 100644 --- a/src/lotus-engine.cpp +++ b/src/lotus-engine.cpp @@ -420,6 +420,7 @@ namespace fcitx { statusArea.addAction(StatusGroup::InputMethod, modernStyleAction_.get()); statusArea.addAction(StatusGroup::InputMethod, freeMarkingAction_.get()); statusArea.addAction(StatusGroup::InputMethod, fixUinputWithAckAction_.get()); + statusArea.addAction(StatusGroup::InputMethod, typingModeMenuAction_.get()); } void LotusEngine::keyEvent(const InputMethodEntry& entry, KeyEvent& keyEvent) {