Customizable candidate window for fcitx5-macos and fcitx5-js, powered by webview.
It can be developed independently of fcitx5.
You may use nvm to install node, then
npm i -g pnpm
pnpm ipnpm devOpen http://localhost:1234 with Safari, as the real candidate window on macOS is rendered by WebKit.
Execute the following JavaScript code to show candidates and more:
// Show candidates with labels, and highlight the first one.
// Show paging buttons but disable previous page.
// Not eligible for scroll mode.
fcitx.setCandidates([
{ text: "虚假的", label: "1", comment: "comment", actions: [{ "id": 1, "text": "删词" }] },
{ text: "🀄", label: "2", comment: "", actions: [] },
{ text: "candidates", label: "3", comment: "", actions: [] }], 0,
true, false, true, 0, false, false)
// Set writing mode. 0=horizontal-tb, 1=vertical-rl, 2=vertical-lr.
fcitx.setWritingMode(1)
// Set vertical layout. 0 means horizontal.
fcitx.setLayout(1)
// Show aux-up.
fcitx.setCandidates([], -1)
fcitx.updateInputPanel([], false, [], [["A", 0]], [])
// Set theme to 0=system (default), 1=light or 2=dark.
fcitx.setTheme(1)To change style, just edit user.scss and refresh the page.
In order to override predefined style in macos.scss,
add div to the selectors so it has higher precedence.
git apply --directory=webview patches/webview.patch
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
cmake --build buildbuild/preview/preview.app/Contents/MacOS/previewThis library, fcitx5-webview, is intended to be a generic and cross-platform webview UI for input methods, regardless of the input method framework. So disregarding the first part of its name, it does NOT depend on fcitx5 directly.