Add Fcitx5 Rime setup with default profile and status checks
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
Executable
+28
@@ -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
|
||||
Executable
+39
@@ -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))
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user