Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move plugins to ~/Library/fcitx5 #8

Merged
merged 3 commits into from
Jan 5, 2024
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
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