diff --git a/bin/omarchy-region b/bin/omarchy-region index 30a36dfd..67abb946 100755 --- a/bin/omarchy-region +++ b/bin/omarchy-region @@ -35,6 +35,8 @@ if [[ $1 == "china" ]]; then omarchy-update-pacman -Syu --noconfirm sudo env OMARCHY_REGION=china OMARCHY_PATH="$OMARCHY_PATH" bash -e "$OMARCHY_PATH/install/config/region.sh" if [[ ! -f $HOME/.local/share/fcitx5/rime/rime_ice.schema.yaml ]]; then + # A running fcitx5 only sees the new Rime addon after a restart. + systemctl --user try-restart omarchy-fcitx5.service rime-ice-installer --yes fi else diff --git a/test/shell.d/region-switch-test.sh b/test/shell.d/region-switch-test.sh index 58f3568b..2450a795 100755 --- a/test/shell.d/region-switch-test.sh +++ b/test/shell.d/region-switch-test.sh @@ -14,7 +14,7 @@ rewrite() { sed -e "s|/etc/|$root/etc/|g" -e "s| /\\.cargo/| $root/.cargo/|g" "$ rewrite "$ROOT/install/config/region.sh" "$sandbox/install/config/region.sh" rewrite "$ROOT/bin/omarchy-region" "$sandbox/bin/omarchy-region" -for command in omarchy-update-pacman omarchy-pkg-add locale-gen rime-ice-installer omarchy-setup-claude-api; do +for command in omarchy-update-pacman omarchy-pkg-add locale-gen rime-ice-installer omarchy-setup-claude-api systemctl; do printf '#!/bin/bash\necho "%s $*" >>"%s"\n' "$command" "$calls" >"$test_tmp/bin/$command" done printf '#!/bin/bash\n[[ $1 == env ]] && shift\nexec env "$@"\n' >"$test_tmp/bin/sudo" @@ -33,7 +33,7 @@ omarchy-region china >/dev/null [[ $(<"$root/etc/pacman.conf") == "$china_conf" && $(<"$root/etc/pacman.d/mirrorlist") == "$china_mirrors" ]] || fail "switching to China lists the .cn mirrors first" [[ $(omarchy-region) == "China" && $(<"$root/etc/locale.conf") == "LANG=zh_CN.UTF-8" ]] || fail "switching to China records it and sets the language" -[[ $(<"$calls") == $'omarchy-update-pacman -Syu --noconfirm\nomarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer\nlocale-gen \nrime-ice-installer --yes' ]] || +[[ $(<"$calls") == $'omarchy-update-pacman -Syu --noconfirm\nomarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer\nlocale-gen \nsystemctl --user try-restart omarchy-fcitx5.service\nrime-ice-installer --yes' ]] || fail "China upgrades in full before installing Rime, then sets Rime Ice up" "$(<"$calls")" pass "switching to China sets mirrors, language and Rime Ice" @@ -42,7 +42,7 @@ mkdir -p "$HOME/.local/share/fcitx5/rime" && touch "$HOME/.local/share/fcitx5/ri omarchy-region china >/dev/null [[ $(<"$root/etc/pacman.conf") == "$china_conf" && $(<"$root/etc/pacman.d/mirrorlist") == "$china_mirrors" ]] || fail "switching to China twice adds no second .cn line" -grep -q '^rime-ice-installer' "$calls" && fail "an existing Rime Ice setup is not redone" +grep -q '^rime-ice-installer\|^systemctl' "$calls" && fail "an existing Rime Ice setup is not redone" pass "switching to China again changes nothing it already did" printf 'Server = https://stable-mirror.omarchy.cn/$repo/os/$arch\nServer = https://stable-mirror.omarchy.org/$repo/os/$arch\nServer = https://mirror.omarchy.org/$repo/os/$arch\n' >"$root/etc/pacman.d/mirrorlist"