Align the China region to the official cn profile

The region value is cn, the China files live under default/regions/cn/, and
omarchy-apply-pacman renders pacman for every caller: the .cn twins of the
channel servers first, then .org, USTC and ArchLinuxCN. Switching to China
installs and trusts the ArchLinuxCN keyring. A migration renames china to cn
and repoints the drop-in links.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 11:33:01 -04:00
1 parent d2e4a95aed
commit 9a57690e7d
20 files changed
+119 -99

No files matched your search

+8 -8
View File
@@ -1,4 +1,4 @@
china_links=(
cn_links=(
"environment.conf /etc/environment.d/90-omarchy-china.conf"
"cargo.toml /.cargo/config.toml"
"gemrc /etc/gemrc"
@@ -8,17 +8,17 @@ case ${OMARCHY_REGION:-global} in
global)
rm -f /etc/omarchy/region
sed -i 's/^LANG=zh_CN\.UTF-8$/LANG=en_US.UTF-8/' /etc/locale.conf
for link in "${china_links[@]}"; do
for link in "${cn_links[@]}"; do
read -r _ target <<<"$link"
if [[ -L $target && $(readlink "$target") == */default/region/china/* ]]; then
if [[ -L $target && $(readlink "$target") == */default/regions/cn/* ]]; then
rm "$target"
fi
done
;;
china)
cn)
# Packages first, so a failed install leaves the machine Global.
omarchy-pkg-add fcitx5-configtool fcitx5-rime librime opencc rime-ice-installer
for link in "${china_links[@]}"; do
for link in "${cn_links[@]}"; do
read -r _ target <<<"$link"
if [[ -e $target && ! -L $target ]]; then
echo "Refusing to replace $target, which Omarchy did not create" >&2
@@ -26,11 +26,11 @@ china)
fi
done
mkdir -p /etc/omarchy
echo china >/etc/omarchy/region
for link in "${china_links[@]}"; do
echo cn >/etc/omarchy/region
for link in "${cn_links[@]}"; do
read -r source target <<<"$link"
mkdir -p "${target%/*}"
ln -sfn "$OMARCHY_PATH/default/region/china/$source" "$target"
ln -sfn "$OMARCHY_PATH/default/regions/cn/$source" "$target"
done
sed -i 's/^#\(zh_CN\.UTF-8 UTF-8\)/\1/' /etc/locale.gen
locale-gen
+6 -3
View File
@@ -129,12 +129,15 @@ omarchy_prompt_region() {
china="China 中国"
header="Select region · 选择区域"
fi
[[ $region == "china" ]] && selected=$china
[[ $region == "cn" ]] && selected=$china
choice=$(printf '%s\n' Global "$china" | gum choose --selected "$selected" --header "$header") && status=0 || status=$?
((status == 0)) || return $status
region=${choice%% *}
region=${region,,}
if [[ $choice == "Global" ]]; then
region=global
else
region=cn
fi
}
omarchy_prompt_keyboard() {