Skip to content

Commit 2c8aaf5

Browse files
authored
Merge pull request #93 from Sunwenzhi58/codex/issue-10-custom-keymap
feat(macOS): 支持自定义快捷键
2 parents 42c9f57 + 7658c88 commit 2c8aaf5

27 files changed

Lines changed: 2710 additions & 191 deletions
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: Release macOS Preview
2+
3+
on:
4+
schedule:
5+
# GitHub Actions schedules are approximate and may be delayed by queueing.
6+
- cron: "17 3 * * *"
7+
workflow_dispatch:
8+
inputs:
9+
source_branch:
10+
description: "Preview branch to build"
11+
required: true
12+
default: "preview/0.3.0"
13+
type: string
14+
15+
permissions:
16+
contents: read
17+
18+
concurrency:
19+
group: release-preview-macos
20+
cancel-in-progress: false
21+
22+
env:
23+
PREVIEW_BRANCH: preview/0.3.0
24+
PREVIEW_VERSION: 0.3.0
25+
PREVIEW_TAG: preview-0.3.0
26+
27+
jobs:
28+
build:
29+
name: Build ${{ matrix.architecture }} preview
30+
if: github.actor == github.repository_owner || github.event_name == 'schedule'
31+
runs-on: macos-14
32+
timeout-minutes: 30
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
architecture:
37+
- arm64
38+
- x86_64
39+
40+
steps:
41+
- name: Check out preview source
42+
uses: actions/checkout@v7
43+
with:
44+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.source_branch || env.PREVIEW_BRANCH }}
45+
46+
- name: Record source revision
47+
id: source
48+
shell: bash
49+
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
50+
51+
- name: Set up Swift
52+
uses: swift-actions/setup-swift@v2
53+
with:
54+
swift-version: "6.2"
55+
56+
- name: Set up Rust target
57+
uses: dtolnay/rust-toolchain@stable
58+
with:
59+
targets: ${{ matrix.architecture == 'arm64' && 'aarch64-apple-darwin' || 'x86_64-apple-darwin' }}
60+
61+
- name: Restore SwiftPM dependencies
62+
uses: actions/cache@v6
63+
with:
64+
path: |
65+
.build/checkouts
66+
.build/repositories
67+
~/.cache/org.swift.swiftpm
68+
key: swiftpm-${{ runner.os }}-6.2-${{ hashFiles('Package.resolved') }}
69+
70+
- name: Restore Cargo dependencies
71+
uses: actions/cache@v6
72+
with:
73+
path: |
74+
~/.cargo/git
75+
~/.cargo/registry
76+
key: cargo-dependencies-${{ runner.os }}-${{ hashFiles('rust/Cargo.lock') }}
77+
78+
- name: Build and package the preview app
79+
env:
80+
LITHE_ARCH: ${{ matrix.architecture }}
81+
LITHE_VERSION: ${{ env.PREVIEW_VERSION }}
82+
LITHE_BUILD_NUMBER: ${{ github.run_number }}
83+
run: |
84+
./scripts/package-app.sh
85+
./scripts/create-dmg.sh
86+
dmg_name="Lithe-${LITHE_VERSION}-${LITHE_ARCH}.dmg"
87+
(cd dist && shasum -a 256 "$dmg_name" > "$dmg_name.sha256")
88+
89+
- name: Verify the preview bundle and disk image
90+
env:
91+
LITHE_ARCH: ${{ matrix.architecture }}
92+
LITHE_VERSION: ${{ env.PREVIEW_VERSION }}
93+
run: |
94+
app_path="dist/Lithe-${LITHE_ARCH}.app"
95+
dmg_path="dist/Lithe-${LITHE_VERSION}-${LITHE_ARCH}.dmg"
96+
codesign --verify --deep --strict "$app_path"
97+
/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$app_path/Contents/Info.plist"
98+
/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" "$app_path/Contents/Info.plist"
99+
lipo "$app_path/Contents/MacOS/Lithe" -verify_arch "$LITHE_ARCH"
100+
hdiutil imageinfo "$dmg_path" > /dev/null
101+
test -s "$dmg_path"
102+
(cd dist && shasum -a 256 -c "Lithe-${LITHE_VERSION}-${LITHE_ARCH}.dmg.sha256")
103+
104+
- name: Upload preview artifacts
105+
uses: actions/upload-artifact@v7
106+
with:
107+
name: macos-preview-${{ matrix.architecture }}
108+
path: |
109+
dist/Lithe-${{ env.PREVIEW_VERSION }}-${{ matrix.architecture }}.dmg
110+
dist/Lithe-${{ env.PREVIEW_VERSION }}-${{ matrix.architecture }}.dmg.sha256
111+
if-no-files-found: error
112+
retention-days: 14
113+
114+
publish:
115+
name: Publish rolling macOS preview
116+
needs: build
117+
runs-on: ubuntu-latest
118+
permissions:
119+
contents: write
120+
121+
steps:
122+
- name: Check out preview source
123+
uses: actions/checkout@v7
124+
with:
125+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.source_branch || env.PREVIEW_BRANCH }}
126+
127+
- name: Record source revision
128+
id: source
129+
shell: bash
130+
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
131+
132+
- name: Download preview artifacts
133+
uses: actions/download-artifact@v8
134+
with:
135+
pattern: macos-preview-*
136+
path: dist
137+
merge-multiple: true
138+
139+
- name: Verify downloaded preview artifacts
140+
env:
141+
LITHE_VERSION: ${{ env.PREVIEW_VERSION }}
142+
shell: bash
143+
run: |
144+
for architecture in arm64 x86_64; do
145+
(cd dist && shasum -a 256 -c "Lithe-${LITHE_VERSION}-${architecture}.dmg.sha256")
146+
done
147+
148+
- name: Create or update rolling preview Release
149+
env:
150+
GH_TOKEN: ${{ github.token }}
151+
RELEASE_TAG: ${{ env.PREVIEW_TAG }}
152+
LITHE_VERSION: ${{ env.PREVIEW_VERSION }}
153+
SOURCE_SHA: ${{ steps.source.outputs.sha }}
154+
shell: bash
155+
run: |
156+
if ! gh release view "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
157+
gh release create "$RELEASE_TAG" \
158+
--repo "$GITHUB_REPOSITORY" \
159+
--target "$SOURCE_SHA" \
160+
--title "Lithe ${LITHE_VERSION} Preview" \
161+
--notes "Rolling Preview build from ${SOURCE_SHA}. This release is replaced by the next scheduled build." \
162+
--prerelease
163+
else
164+
gh release edit "$RELEASE_TAG" \
165+
--repo "$GITHUB_REPOSITORY" \
166+
--target "$SOURCE_SHA" \
167+
--title "Lithe ${LITHE_VERSION} Preview" \
168+
--notes "Rolling Preview build from ${SOURCE_SHA}. This release is replaced by the next scheduled build." \
169+
--prerelease
170+
fi
171+
172+
gh release upload "$RELEASE_TAG" \
173+
"dist/Lithe-${LITHE_VERSION}-arm64.dmg" \
174+
"dist/Lithe-${LITHE_VERSION}-arm64.dmg.sha256" \
175+
"dist/Lithe-${LITHE_VERSION}-x86_64.dmg" \
176+
"dist/Lithe-${LITHE_VERSION}-x86_64.dmg.sha256" \
177+
--repo "$GITHUB_REPOSITORY" \
178+
--clobber

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ See [Repository layout and shared boundaries](./docs/architecture/repository-lay
233233
</a>
234234
</td>
235235
<td>
236-
<a href="https://www.fastaitoken.com/"><strong>FastAI</strong></a> provides access to large language models and supports the development of Lithe. Thank you to FastAI for supporting this project!
236+
<a href="https://www.fastaitoken.com/"><strong>FastAI</strong></a> provides convenient relay access to a range of leading large language models, making it easier to connect AI capabilities to everyday development workflows. Its support helps Lithe continue improving its AI-assisted experience. Thank you to FastAI for supporting this project!
237237
</td>
238238
</tr>
239239
<tr>
@@ -243,7 +243,27 @@ See [Repository layout and shared boundaries](./docs/architecture/repository-lay
243243
</a>
244244
</td>
245245
<td>
246-
<a href="https://codezsy.com"><strong>CodeZ</strong></a> provides relay access to GPT-family models and supports the development of Lithe. Thank you to CodeZ for supporting this project!
246+
<a href="https://codezsy.com"><strong>CodeZ</strong></a> focuses on stable relay access to GPT-family models, offering developers a straightforward way to integrate model APIs into their tools and projects. Its sponsorship contributes to the ongoing development and maintenance of Lithe. Thank you to CodeZ for supporting this project!
247+
</td>
248+
</tr>
249+
<tr>
250+
<td width="112" align="center">
251+
<a href="https://api.axis.fan/register?aff=4EZFN7322WTH">
252+
<img src="./docs/assets/sponsors/yuanliu-token.png" width="64" alt="Yuanliu Token">
253+
</a>
254+
</td>
255+
<td>
256+
<a href="https://api.axis.fan/register?aff=4EZFN7322WTH"><strong>Yuanliu Token</strong></a> offers relay access to multiple large language model APIs, giving developers a flexible entry point for experimenting with different models and building AI applications. Its sponsorship supports Lithe as the project expands and polishes its AI features. Thank you to Yuanliu Token for supporting this project!
257+
</td>
258+
</tr>
259+
<tr>
260+
<td width="112" align="center">
261+
<a href="https://torchai.ai">
262+
<img src="./docs/assets/sponsors/torchai.jpg" width="64" alt="TorchAI">
263+
</a>
264+
</td>
265+
<td>
266+
<a href="https://torchai.ai"><strong>TorchAI</strong></a> provides large language model relay services for developers who need convenient API access across coding, content, and automation scenarios. Its support helps sustain Lithe's development and exploration of practical AI-powered tools. Thank you to TorchAI for supporting this project!
247267
</td>
248268
</tr>
249269
<tr>
@@ -253,7 +273,7 @@ See [Repository layout and shared boundaries](./docs/architecture/repository-lay
253273
</a>
254274
</td>
255275
<td>
256-
<a href="https://shu26.cfd/"><strong>Code GO</strong></a> provides relay access to Claude models and supports the development of Lithe. Thank you to Code GO for supporting this project!
276+
<a href="https://shu26.cfd/"><strong>Code GO</strong></a> specializes in relay services for Claude models, helping users access capable coding and reasoning models with less setup overhead. Its support gives Lithe more room to refine model integration and developer workflows. Thank you to Code GO for supporting this project!
257277
</td>
258278
</tr>
259279
</table>

README.zh-CN.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ open dist/Lithe.app
227227
</a>
228228
</td>
229229
<td>
230-
<a href="https://www.fastaitoken.com/"><strong>FastAI</strong></a> 提供大模型服务支持,并助力 Lithe 的开发。感谢 FastAI 对本项目的支持!
230+
<a href="https://www.fastaitoken.com/"><strong>FastAI</strong></a> 提供多款主流大模型的便捷中转服务,让开发者可以更轻松地把 AI 能力接入日常开发流程。其支持也帮助 Lithe 持续完善 AI 辅助体验。感谢 FastAI 对本项目的支持!
231231
</td>
232232
</tr>
233233
<tr>
@@ -237,7 +237,27 @@ open dist/Lithe.app
237237
</a>
238238
</td>
239239
<td>
240-
<a href="https://codezsy.com"><strong>CodeZ</strong></a> 提供 GPT 系列模型的中转支持,并支持 Lithe 的开发。感谢 CodeZ 对本项目的支持!
240+
<a href="https://codezsy.com"><strong>CodeZ</strong></a> 专注于 GPT 系列模型的稳定中转,为开发者在工具和项目中集成模型 API 提供简单直接的选择。其赞助为 Lithe 的持续开发与维护提供了助力。感谢 CodeZ 对本项目的支持!
241+
</td>
242+
</tr>
243+
<tr>
244+
<td width="112" align="center">
245+
<a href="https://api.axis.fan/register?aff=4EZFN7322WTH">
246+
<img src="./docs/assets/sponsors/yuanliu-token.png" width="64" alt="元流 Token">
247+
</a>
248+
</td>
249+
<td>
250+
<a href="https://api.axis.fan/register?aff=4EZFN7322WTH"><strong>元流 Token</strong></a> 提供多种大语言模型 API 的中转接入,为开发者体验不同模型、构建 AI 应用提供灵活入口。其赞助支持 Lithe 持续拓展并优化 AI 相关功能。感谢元流 Token 对本项目的支持!
251+
</td>
252+
</tr>
253+
<tr>
254+
<td width="112" align="center">
255+
<a href="https://torchai.ai">
256+
<img src="./docs/assets/sponsors/torchai.jpg" width="64" alt="TorchAI">
257+
</a>
258+
</td>
259+
<td>
260+
<a href="https://torchai.ai"><strong>TorchAI</strong></a> 面向开发者提供大模型中转服务,便于在编程、内容生成和自动化等不同场景中调用模型 API。其支持帮助 Lithe 保持持续开发,并探索更实用的 AI 工具体验。感谢 TorchAI 对本项目的支持!
241261
</td>
242262
</tr>
243263
<tr>
@@ -247,7 +267,7 @@ open dist/Lithe.app
247267
</a>
248268
</td>
249269
<td>
250-
<a href="https://shu26.cfd/"><strong>Code GO</strong></a> 提供 Claude 系列模型的中转支持,并支持 Lithe 的开发。感谢 Code GO 对本项目的支持!
270+
<a href="https://shu26.cfd/"><strong>Code GO</strong></a> 主要提供 Claude 系列模型的中转服务,帮助用户以更低的接入成本使用擅长编程与推理的模型。其支持让 Lithe 能够继续打磨模型集成和开发者工作流。感谢 Code GO 对本项目的支持!
251271
</td>
252272
</tr>
253273
</table>

Resources/zh-Hans.lproj/Localizable.strings

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,31 @@
1616
"Choose whether Lithe follows the system appearance or always uses a light or dark theme." = "选择跟随系统外观,或始终使用浅色或深色主题。";
1717
"Choose a color theme and whether Lithe follows the system appearance." = "选择配色主题,并设置是否跟随系统外观。";
1818
"Editor" = "编辑器";
19+
"Keymap" = "快捷键";
20+
"Customize shortcuts for Lithe actions. Changes apply immediately." = "自定义 Lithe 操作的快捷键,修改后立即生效。";
21+
"Search actions or shortcuts" = "搜索操作或快捷键";
22+
"Restore All Defaults" = "全部恢复默认";
23+
"Not Assigned" = "未分配";
24+
"Press shortcut…" = "请按下快捷键…";
25+
"Shortcut needs Command, Control, or Option" = "快捷键需要包含 Command、Control 或 Option";
26+
"Conflicts with %@" = "与 %@ 冲突";
27+
"Shortcut is already assigned to this command" = "该命令已使用此快捷键";
28+
"No matching commands" = "没有匹配的命令";
29+
"Add Shortcut" = "添加快捷键";
30+
"Save the active document" = "保存当前文档";
31+
"Move to the next match in the active editor" = "跳转到当前编辑器中的下一个匹配项";
32+
"Move to the previous match in the active editor" = "跳转到当前编辑器中的上一个匹配项";
33+
"Navigate to a call site of the selected symbol" = "跳转到所选符号的调用位置";
34+
"Navigate to an implementation of the selected symbol" = "跳转到所选符号的实现";
35+
"Find references to the selected symbol" = "查找所选符号的引用";
36+
"Find in Files" = "在项目中查找";
37+
"Replace in Files" = "在项目中替换";
38+
"Replace text across the workspace" = "替换工作区中的文本";
39+
"Show or hide language diagnostics" = "显示或隐藏语言诊断";
40+
"Toggle Tests" = "切换测试窗口";
41+
"Show or hide language-neutral test runners" = "显示或隐藏通用测试运行器";
42+
"Search Everywhere" = "全局搜索";
43+
"Find files and actions" = "查找文件和操作";
1944
"Terminal" = "终端";
2045
"Updates" = "更新";
2146
"AI & Commit" = "AI 与提交";

0 commit comments

Comments
 (0)