diff --git a/bin/omarchy-cn-app-install b/bin/omarchy-cn-app-install new file mode 100755 index 00000000..5c9afaa7 --- /dev/null +++ b/bin/omarchy-cn-app-install @@ -0,0 +1,46 @@ +#!/bin/bash +# omarchy:summary=Install a China app from the catalog with source confirmation +# omarchy:args= [--yes] +# omarchy:examples=omarchycn app install wechat | omarchycn app install tencent-docs + +set -euo pipefail + +APPS_JSON="$OMARCHY_PATH/cn/apps.json" + +app="${1:?usage: omarchycn app install (see: omarchycn app list)}" +yes="${2:-}" + +entry=$(jq -e --arg a "$app" '.apps[$a]' "$APPS_JSON") || { + echo "Unknown app: $app (see: omarchycn app list)" >&2 + exit 1 +} + +name=$(jq -r '.name' <<<"$entry") +source_type=$(jq -r '.source' <<<"$entry") +license=$(jq -r '.license' <<<"$entry") + +if [[ $license == "proprietary" && $yes != "--yes" ]]; then + pkg=$(jq -r '.package' <<<"$entry") + echo "$name 为专有软件,来源: AUR/$pkg(构建脚本公开,二进制来自厂商)" + if [[ -t 0 ]]; then + gum confirm "确认安装?" || exit 1 + else + echo "非交互环境需显式加 --yes 确认专有软件安装" >&2 + exit 1 + fi +fi + +case "$source_type" in +aur) + omarchy-pkg-add "$(jq -r '.package' <<<"$entry")" + ;; +webapp) + omarchy-webapp-install "$name" "$(jq -r '.url' <<<"$entry")" "$(jq -r '.icon' <<<"$entry")" + ;; +*) + echo "Unknown source type: $source_type" >&2 + exit 1 + ;; +esac + +echo "$name 安装完成" diff --git a/bin/omarchy-cn-app-list b/bin/omarchy-cn-app-list new file mode 100755 index 00000000..e048525d --- /dev/null +++ b/bin/omarchy-cn-app-list @@ -0,0 +1,15 @@ +#!/bin/bash +# omarchy:summary=List China app catalog entries and their sources +# omarchy:examples=omarchycn app list + +set -euo pipefail + +APPS_JSON="$OMARCHY_PATH/cn/apps.json" + +printf '%-14s %-10s %-8s %-12s %s\n' "ID" "NAME" "SOURCE" "LICENSE" "PACKAGE/URL" +jq -r '.apps | to_entries[] | + [.key, .value.name, .value.source, .value.license, (.value.package // .value.url)] | @tsv' \ + "$APPS_JSON" | + while IFS=$'\t' read -r id name source license ref; do + printf '%-14s %-10s %-8s %-12s %s\n' "$id" "$name" "$source" "$license" "$ref" + done diff --git a/bin/omarchy-cn-setup b/bin/omarchy-cn-setup new file mode 100755 index 00000000..b80bd962 --- /dev/null +++ b/bin/omarchy-cn-setup @@ -0,0 +1,73 @@ +#!/bin/bash +# omarchy:summary=First-run wizard: locale, fonts, IME, hotkey, mirrors, AI +# omarchy:examples=omarchycn setup + +set -euo pipefail + +if [[ ! -t 0 ]]; then + echo "omarchycn setup 需要交互终端" >&2 + exit 1 +fi + +STATE_DIR="$HOME/.local/state/omarchycn/setup-done" +mkdir -p "$STATE_DIR" + +run_step() { + local step="$1" title="$2" + shift 2 + + if [[ -f $STATE_DIR/$step ]]; then + gum confirm "「$title」已完成,重新运行?" --default=false || return 0 + fi + echo "==> $title" + if "$@"; then + touch "$STATE_DIR/$step" + else + gum confirm "「$title」失败,继续后面的步骤?" || exit 1 + fi +} + +step_hotkey() { + local choice + choice=$(gum choose --header "输入法切换键" "ctrl-space" "super-space") + omarchy-cn-ime-hotkey "$choice" +} + +step_mirror() { + local choice + choice=$(gum choose --header "pacman 镜像策略" "china" "official") + omarchy-cn-mirror-apply "$choice" +} + +step_dev_mirror() { + local choice + choice=$(gum choose --header "开发工具镜像(npm/pip/cargo/go/gem)" "china" "official" "skip") + if [[ $choice == "skip" ]]; then + return 0 + fi + omarchy-cn-dev-mirror-apply "$choice" --target npm,pip,cargo,go,gem +} + +step_apps() { + local picks + picks=$(omarchy-cn-app-list | tail -n +2 | awk '{print $1}' | + gum choose --no-limit --header "选择要安装的国内应用(空格多选,回车跳过)" || true) + local app + for app in $picks; do + omarchy-cn-app-install "$app" + done +} + +run_step locale "中文 Locale 生成" omarchy-cn-locale-apply +run_step fonts "中文字体与 fallback" omarchy-cn-font-apply +run_step ime "Fcitx5 + Rime 输入法" omarchy-cn-ime-apply +run_step hotkey "输入法切换键" step_hotkey +run_step mirror "pacman 镜像" step_mirror +run_step dev-mirror "开发工具镜像" step_dev_mirror +run_step apps "国内应用" step_apps +run_step ai "AI Hub(Harness/Provider/Key)" omarchy-cn-ai-setup + +echo +echo "==> 最终检查" +omarchy-cn-doctor all || true +echo "OmarchyCN 初始化完成。随时可用 omarchycn setup 重进任一步骤。" diff --git a/cn/apps.json b/cn/apps.json new file mode 100644 index 00000000..b0f96ce1 --- /dev/null +++ b/cn/apps.json @@ -0,0 +1,14 @@ +{ + "_verified": "2026-08-24, AUR RPC 实证在维护且未 out-of-date", + "apps": { + "wechat": { "name": "微信", "source": "aur", "package": "wechat-universal-bwrap", "license": "proprietary" }, + "qq": { "name": "QQ", "source": "aur", "package": "linuxqq", "license": "proprietary" }, + "feishu": { "name": "飞书", "source": "aur", "package": "feishu-bin", "license": "proprietary" }, + "dingtalk": { "name": "钉钉", "source": "aur", "package": "dingtalk-bin", "license": "proprietary" }, + "wemeet": { "name": "腾讯会议", "source": "aur", "package": "wemeet-bin", "license": "proprietary" }, + "wps": { "name": "WPS Office", "source": "aur", "package": "wps-office-cn", "license": "proprietary" }, + "tencent-docs": { "name": "腾讯文档", "source": "webapp", "url": "https://docs.qq.com", "icon": "https://docs.qq.com/favicon.ico", "license": "web" }, + "yuque": { "name": "语雀", "source": "webapp", "url": "https://www.yuque.com/dashboard", "icon": "https://www.yuque.com/favicon.ico", "license": "web" }, + "shimo": { "name": "石墨文档", "source": "webapp", "url": "https://shimo.im/desktop", "icon": "https://shimo.im/favicon.ico", "license": "web" } + } +}