Add Material 3 candidate window addon for Fcitx5

Fork of the classicui addon (Fcitx5 5.1.23) with a Material 3 look, spring
based animations and a right click action menu for candidates.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
justmeandClaude Sonnet 5.5 committed 2026-10-19 21:58:54 +08:00
commit 0804634dc1
68 files changed
+11474

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
# Builds libm3ui.so against an upstream Fcitx5 source tree of the same version
# as the Fcitx5 installed on this system. The addon needs Fcitx5's internal
# Wayland protocol wrappers, which are not part of fcitx5-devel, so it is built
# inside the upstream tree.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
work=${WORK_DIR:-$root/build}
version=${FCITX_VERSION:-$(pkg-config --modversion Fcitx5Core)}
# Commit of the yoga submodule pinned by Fcitx5 (third_party/yoga).
yoga_commit=${YOGA_COMMIT:-042f5013152eb81c1552dec945b88f7b95ca350f}
srcdir=$work/fcitx5-$version
mkdir -p "$work"
if [ ! -d "$srcdir" ]; then
echo ">> fetching Fcitx5 $version"
curl -fsSL "https://github.com/fcitx/fcitx5/archive/refs/tags/$version.tar.gz" |
tar -xz -C "$work"
fi
if [ ! -f "$srcdir/third_party/yoga/yoga/CMakeLists.txt" ]; then
echo ">> fetching yoga $yoga_commit"
rm -rf "$srcdir/third_party/yoga"
mkdir -p "$srcdir/third_party/yoga"
curl -fsSL "https://github.com/facebook/yoga/archive/$yoga_commit.tar.gz" |
tar -xz -C "$srcdir/third_party/yoga" --strip-components=1
fi
echo ">> overlaying m3ui"
rm -rf "$srcdir/src/ui/m3ui"
cp -r "$root/src" "$srcdir/src/ui/m3ui"
if ! grep -q 'add_subdirectory(m3ui)' "$srcdir/src/ui/CMakeLists.txt"; then
sed -i 's/^add_subdirectory(classic)$/add_subdirectory(classic)\nadd_subdirectory(m3ui)/' \
"$srcdir/src/ui/CMakeLists.txt"
fi
echo ">> configuring"
cmake -S "$srcdir" -B "$work/cmake" -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${PREFIX:-$HOME/.local/m3ui}" \
-DENABLE_X11=On -DENABLE_WAYLAND=On \
-DENABLE_TEST=Off -DENABLE_TESTING_ADDONS=Off -DENABLE_ENCHANT=Off \
-DENABLE_DOC=Off -DENABLE_XDGAUTOSTART=Off -DENABLE_EMOJI=Off
echo ">> building"
ninja -C "$work/cmake" m3ui src/ui/m3ui/m3ui.conf
echo ">> done, run scripts/install.sh"
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# Installs the addon, the themes and an example config into your home
# directory. Nothing outside $HOME is touched and the stock classicui stays
# available.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
work=${WORK_DIR:-$root/build}
prefix=${PREFIX:-$HOME/.local/m3ui}
data=${XDG_DATA_HOME:-$HOME/.local/share}/fcitx5
config=${XDG_CONFIG_HOME:-$HOME/.config}/fcitx5
# Going through cmake's install step strips the build tree rpath, otherwise the
# addon would load a second copy of libFcitx5Core from the build directory.
cmake -DCMAKE_INSTALL_PREFIX="$prefix" -P "$work/cmake/src/ui/m3ui/cmake_install.cmake"
mkdir -p "$data/addon" "$data/themes" "$config/conf"
cp "$prefix/share/fcitx5/addon/m3ui.conf" "$data/addon/m3ui.conf"
cp -r "$root"/themes/* "$data/themes/"
if [ ! -e "$config/conf/m3ui.conf" ]; then
cp "$root/config/m3ui.conf.example" "$config/conf/m3ui.conf"
fi
addondir=$(dirname "$(find "$prefix" -name libm3ui.so | head -1)")
cat <<MSG
Installed. Try it with:
FCITX_ADDON_DIRS=$addondir:\$(pkg-config --variable=addondir Fcitx5Core 2>/dev/null || echo /usr/lib64/fcitx5) fcitx5 -r -u m3ui
Go back to the stock interface with: fcitx5 -r
MSG