Skip to content

Commit

Permalink
move plugins to ~/Library/fcitx5 (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj authored Jan 5, 2024
1 parent f41d0c2 commit e1ba99e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ cmake --build build
sudo cmake --install build
```

## Debug
### Console.app
* Check `Include Info Messages` and `Include Debug Messages` in `Action` menu.
* Put `FcitxLog` in `Search`.

### lldb
SSH into the mac from another device, then
```sh
$ /usr/bin/lldb
(lldb) process attach --name Fcitx5
```

## Plugins
Fcitx5 only packges keyboard engine.
To install other engines, see [fcitx5-macos-plugins](https://github.com/fcitx-contrib/fcitx5-macos-plugins).

## Credits
* [fcitx5-android](https://github.com/fcitx5-android/fcitx5-android): LGPL-2.1-or-later
* [squirrel](https://github.com/rime/squirrel): GPL-3.0-only
Expand Down
19 changes: 17 additions & 2 deletions src/fcitx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,24 @@ void setupLog(bool verbose) {

void start_fcitx() {
setupLog(true);

// ~/Library/fcitx5
std::string fcitx5_prefix = std::string(getenv("HOME")) + "/Library/fcitx5";

// /Library/Input\ Methods/Fcitx5.app/Contents/lib/fcitx5:~/Library/fcitx5/lib/fcitx5
// Separate plugins so that dmg replacement won't remove them
setenv("FCITX_ADDON_DIRS",
APP_CONTENTS_PATH "/lib/fcitx5:/usr/local/lib/fcitx5", 1);
std::string fcitx_addon_dirs =
APP_CONTENTS_PATH "/lib/fcitx5:" + fcitx5_prefix + "/lib/fcitx5";
setenv("FCITX_ADDON_DIRS", fcitx_addon_dirs.c_str(), 1);

// ~/Library/fcitx5/share
std::string xdg_data_dirs = fcitx5_prefix + "/share";
setenv("XDG_DATA_DIRS", xdg_data_dirs.c_str(), 1);

// ~/Library/fcitx5/lib/libime
std::string libime_model_dirs = fcitx5_prefix + "/lib/libime";
setenv("LIBIME_MODEL_DIRS", libime_model_dirs.c_str(), 1);

p_instance = std::make_unique<fcitx::Instance>(0, nullptr);
auto &addonMgr = p_instance->addonManager();
addonMgr.registerDefaultLoader(&staticAddon);
Expand Down

0 comments on commit e1ba99e

Please sign in to comment.