diff --git a/bin/omarchy-cn-ime-apply b/bin/omarchy-cn-ime-apply new file mode 100755 index 00000000..15f532c5 --- /dev/null +++ b/bin/omarchy-cn-ime-apply @@ -0,0 +1,28 @@ +#!/bin/bash +# omarchy:summary=Install Fcitx5 Rime and Chinese addons with a default profile +# omarchy:examples=omarchycn ime apply + +set -euo pipefail + +omarchy-pkg-add fcitx5-rime fcitx5-chinese-addons fcitx5-configtool + +profile_dir="$HOME/.config/fcitx5" +mkdir -p "$profile_dir" + +if [[ -f $profile_dir/profile ]] && ! grep -q '^Name=rime$' "$profile_dir/profile"; then + backup_dir="$HOME/.local/state/omarchycn/backups/ime/$(date +%Y%m%d-%H%M%S)" + mkdir -p "$backup_dir" + cp "$profile_dir/profile" "$backup_dir/profile" + echo "Existing profile backed up to $backup_dir" +fi + +cp "$OMARCHY_PATH/cn/fcitx5/profile" "$profile_dir/profile" + +if systemctl --user is-active omarchy-fcitx5.service > /dev/null 2>&1; then + systemctl --user restart omarchy-fcitx5.service + echo "Fcitx5 restarted with Rime profile" +else + echo "Fcitx5 profile installed (takes effect at next graphical session)" +fi + +omarchy-cn-ime-status diff --git a/bin/omarchy-cn-ime-status b/bin/omarchy-cn-ime-status new file mode 100755 index 00000000..25dad515 --- /dev/null +++ b/bin/omarchy-cn-ime-status @@ -0,0 +1,39 @@ +#!/bin/bash +# omarchy:summary=Check Fcitx5 Rime installation and configuration +# omarchy:examples=omarchycn ime status + +set -euo pipefail + +failures=0 + +for pkg in fcitx5 fcitx5-gtk fcitx5-qt fcitx5-rime fcitx5-chinese-addons; do + if pacman -Q "$pkg" > /dev/null 2>&1; then + echo "PASS ime: $pkg installed" + else + echo "FAIL ime: $pkg missing" + failures=$((failures + 1)) + fi +done + +if grep -sq '^Name=rime$' "$HOME/.config/fcitx5/profile"; then + echo "PASS ime: rime in fcitx5 profile" +else + echo "FAIL ime: rime not in fcitx5 profile (run: omarchycn ime apply)" + failures=$((failures + 1)) +fi + +env_file="/usr/share/omarchy/default/environment.d/10-omarchy-fcitx.conf" +if [[ -f $env_file ]] || [[ -f $OMARCHY_PATH/default/environment.d/10-omarchy-fcitx.conf ]]; then + echo "PASS ime: fcitx environment file present" +else + echo "FAIL ime: fcitx environment file missing" + failures=$((failures + 1)) +fi + +if pgrep -x fcitx5 > /dev/null 2>&1; then + echo "PASS ime: fcitx5 running" +else + echo "INFO ime: fcitx5 not running (headless session?)" +fi + +exit $((failures > 0 ? 1 : 0)) diff --git a/cn/fcitx5/profile b/cn/fcitx5/profile new file mode 100644 index 00000000..8768d628 --- /dev/null +++ b/cn/fcitx5/profile @@ -0,0 +1,15 @@ +[Groups/0] +Name=Default +Default Layout=us +DefaultIM=rime + +[Groups/0/Items/0] +Name=keyboard-us +Layout= + +[Groups/0/Items/1] +Name=rime +Layout= + +[GroupOrder] +0=Default