Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,16 +424,16 @@ After logging out and logging in again:

<a id="usage-guide"></a>

## 📖 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.
- **Customization options:** _Typing Mode_, _Input Method_, _Charset_, _Spell Check_, _Macro_, _Capitalize Macro_, _Auto non-VN restore_, _Modern Style_, _Free Marking_, _Fix Uinput with ack_.
- **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.
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 |
| :-------------------- | :------: | :-------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,17 @@ 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.

<details>
<details>
<summary><b>Cấu hình thêm cho Wayland (KDE, Hyprland)</b></summary>

- **KDE Plasma:** _System Settings_ → _Keyboard_ → _Virtual Keyboard_ → Chọn **Fcitx 5**.
- **Hyprland:** Thêm dòng sau vào `~/.config/hypr/hyprland.conf`:

```ini
permission = fcitx5-lotus-server, keyboard, allow
```

</details>
</details>

---

Expand All @@ -431,24 +431,25 @@ 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<br/>Nên bật khi sử dụng các ứng dụng Chromium (Chrome, Brave, Edge, ...). | Tắ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.<br/>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.
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ả |
| :-------------------- | :------: | :----------------------------------------------------------------------------------------------------------------------------------- |
Expand Down
1 change: 1 addition & 0 deletions src/lotus-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ namespace fcitx {
Option<bool> modernStyle{this, "ModernStyle", _("Use oà, _uý (instead of òa, úy)"), true};
Option<bool> freeMarking{this, "FreeMarking", _("Allow type with more freedom"), true};
Option<bool> fixUinputWithAck{this, "FixUinputWithAck", _("Fix uinput mode with ack"), false};
Option<bool> modeMenu{this, "ModeMenu", _("Open typing mode menu with ` key"), true};
SubConfigOption customKeymap{this, "CustomKeymap", _("Custom Keymap"), "fcitx://config/addon/lotus/custom_keymap"};);

} // namespace fcitx
Expand Down
23 changes: 22 additions & 1 deletion src/lotus-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,17 @@ namespace fcitx {
}));
uiManager.registerAction("lotus-fixuinputwithack", fixUinputWithAckAction_.get());

typingModeMenuAction_ = std::make_unique<SimpleAction>();
typingModeMenuAction_->setLongText(_("Open typing mode menu"));
typingModeMenuAction_->setIcon("input-keyboard");
typingModeMenuAction_->setCheckable(true);
connections_.emplace_back(typingModeMenuAction_->connect<SimpleAction::Activated>([this](InputContext* ic) {
config_.modeMenu.setValue(!*config_.modeMenu);
saveConfig();
updateTypingModeMenuAction(ic);
}));
uiManager.registerAction("lotus-modemenu", typingModeMenuAction_.get());

reloadConfig();
globalMode_ = modeStringToEnum(config_.mode.value());
updateModeAction(nullptr);
Expand Down Expand Up @@ -329,6 +340,7 @@ namespace fcitx {
updateModernStyleAction(nullptr);
updateFreeMarkingAction(nullptr);
updateFixUinputWithAckAction(nullptr);
updateTypingModeMenuAction(nullptr);
}

void LotusEngine::setSubConfig(const std::string& path, const RawConfig& config) {
Expand Down Expand Up @@ -408,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) {
Expand Down Expand Up @@ -562,7 +575,7 @@ namespace fcitx {
return;
}

if (!keyEvent.isRelease() && keyEvent.rawKey().check(FcitxKey_grave)) {
if (!keyEvent.isRelease() && keyEvent.rawKey().check(FcitxKey_grave) && *config_.modeMenu) {
currentConfigureApp_ = ic->program();
if (currentConfigureApp_.empty())
currentConfigureApp_ = "unknown-app";
Expand Down Expand Up @@ -731,6 +744,14 @@ namespace fcitx {
}
}

void LotusEngine::updateTypingModeMenuAction(InputContext* ic) {
typingModeMenuAction_->setChecked(*config_.modeMenu);
typingModeMenuAction_->setShortText(*config_.modeMenu ? _("Typing Mode Menu: On") : _("Typing Mode Menu: Off"));
if (ic) {
typingModeMenuAction_->update(ic);
}
}

void LotusEngine::loadAppRules() {
appRules_.clear();
std::ifstream file(appRulesPath_);
Expand Down
7 changes: 7 additions & 0 deletions src/lotus-engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ namespace fcitx {
*/
void updateFixUinputWithAckAction(InputContext* ic);

/**
* @brief Updates the mode-menu action UI.
* @param ic Current input context.
*/
void updateTypingModeMenuAction(InputContext* ic);

/**
* @brief Updates the input method action UI.
* @param ic Current input context.
Expand Down Expand Up @@ -315,6 +321,7 @@ namespace fcitx {
std::unique_ptr<SimpleAction> modernStyleAction_;
std::unique_ptr<SimpleAction> freeMarkingAction_;
std::unique_ptr<SimpleAction> fixUinputWithAckAction_;
std::unique_ptr<SimpleAction> typingModeMenuAction_;
std::vector<ScopedConnection> connections_;
CGoObject dictionary_;
std::unordered_map<std::string, LotusMode> appRules_;
Expand Down
Loading