Parcel:一个使用 Zig 构建的 Linux 桌面邮件客户端
Parcel: A desktop mail client for Linux, built with Zig

原始链接: https://tangled.org/rockorager.dev/parcel

Parcel 是一款 Linux 桌面邮件客户端,支持 Gmail、Fastmail 和 JMAP 服务器,使用 Zig 和 siv 构建。它将邮件显示为一个按标签筛选的列表,支持堆叠过滤器,具有 Ctrl+K 帮助的键驱动操作、带嵌套引用和 HTML 渲染的线程视图、带格式工具栏的 Vim 风格编辑器,以及使用 Gmail 运算符和建议的实时搜索。它维护本地邮件索引以实现快速搜索。通过依赖项安装后,运行 `just run` 或 `just install`。设置前会显示示例邮件;通过 Ctrl+K 命令面板添加账户。账户位于 ~/.local/state/parcel/accounts,并从标头中选择;重命名目录时需关闭 Parcel。Gmail 通过浏览器登录并存储刷新令牌;支持自定义 Google 客户端 JSON,且无密钥的源码构建需要它。Fastmail/JMAP 支持浏览器 OAuth 或令牌。开发者使用 mise、just 和 `just ci`。

Parcel 是一个使用 Zig 构建的 Linux 桌面邮件客户端,在 Hacker News 上获得 30 分和若干评论。评论者将其与 Fastmail 的网页界面和应用进行比较,其中一人表示可能最终会使用本地邮件客户端。其他人提到 Thunderbird 更广泛的日历、RSS 和联系人功能。用户询问 Parcel 是否支持从别名发送邮件,并表示偏好文件夹而非标签。一位评论者希望有网页客户端,并强调 JMAP 对良好电子邮件体验的重要性。另一人指出 Fastmail 应用缺少返回/前进导航。还有反馈称该项目的 readme 包含不清楚的“LLM speak”,应重写。总体来说,讨论围绕 Parcel 在现有邮件选项中的潜力及功能预期展开。
相关文章

原文

A mail client for Gmail and Fastmail on the Linux desktop, built with Zig and siv.

Parcel's mail list, light and dark

Parcel shows mail as one list, chosen by label filters you stack: Inbox, or Inbox and Work, or any label alone. Every action has a key, and Ctrl+K lists them all. It reads your Gmail, Fastmail, or any JMAP server once you sign in, and shows sample mail until then. Each account has its own list, and the header switches between them.

A look around #

A thread opens over the list. Quoted replies nest, each level under a rule of its own, and HTML mail shows as its sender laid it out.

A thread open in the reader, its quoted replies nested

r replies, over a quote of what you answer. The editor has Vim's keys and a toolbar for marks, links, quotes, and lists.

A reply being written over the nested quote of the thread

/ searches as you type, with Gmail's operators, whichever account it is. Right after an operator such as from:, it suggests the people, labels, or values it takes. Parcel keeps its own index of your mail, and once it has been through all of it, answers most searches without asking the server.

A search for Lisbon, suggesting people for from:

The mail in these screenshots is made up.

Build it #

Parcel needs Zig 0.17.1, just, a Wayland compositor, and the development files for libcurl, Wayland, xkbcommon, Fontconfig, and the Vulkan headers:

sudo apt install just libcurl4-openssl-dev libwayland-dev libxkbcommon-dev libfontconfig-dev libvulkan-dev  # Debian, Ubuntu
sudo dnf install just libcurl-devel wayland-devel libxkbcommon-devel fontconfig-devel vulkan-headers        # Fedora
sudo pacman -S just curl wayland libxkbcommon fontconfig vulkan-headers                                     # Arch

Then:

just run

Install it #

just install

This puts parcel in ~/.local/bin, and its desktop entry and icon in ~/.local/share, so app launchers list Parcel. Pass another prefix to install elsewhere, such as just install /usr/local (with sudo).

Sign in #

Parcel opens on sample mail under its Add account page until it has an account; after that, the palette's Add account (Ctrl+K) opens the page. Sign in with Google, Fastmail, or another JMAP server; the account opens as soon as you have, named for the address you signed in with.

Each account has a name, its directory's under ~/.local/state/parcel/accounts, which the header shows and Ctrl+1 to Ctrl+9 count in sorted order. Rename an account by renaming its directory while parcel is not running.

Gmail #

Gmail signs in in the browser with Parcel's own Google client, which release builds carry. An account's refresh token is kept in its directory's google-token, readable only by you.

Where a Google Workspace admin blocks apps they have not approved, ask them to trust Parcel's client ID. Or use a client of your own, which Parcel prefers whenever it is there; a build from source without -Dgoogle-client-secret needs one too:

  1. In the Google Cloud console, enable the Gmail API for a project: your organization's, where Workspace trusts its own apps.
  2. Under Google Auth Platform, create a client of type Desktop app. For a project outside your organization, add yourself as a test user.
  3. Download the client's JSON and save it as ~/.config/parcel/google-client.json.
  4. Add the account, and sign in in the browser it opens.

A sign-in works only with the client that made it, so an account signed in with your own client keeps needing its file. While your project's app is in testing, Google expires the sign-in after seven days; sign in again then with parcel login gmail NAME.

Fastmail and other JMAP servers #

Fastmail signs in in the browser: Parcel registers itself with Fastmail as it signs in, so there is nothing to set up. Another JMAP server does the same where it offers OAuth for desktop apps; give it the server's address. Either one also takes a token in place of the browser: for Fastmail, make one in Settings, Privacy & Security, Manage API tokens, with access to Email and Email submission; a token of the form user:password goes as Basic authorization.

The sign-in is kept in the account's directory, readable only by you: jmap-oauth for the browser's, jmap-token for a token. From a terminal, parcel login fastmail NAME and parcel login jmap NAME https://mail.example.org/.well-known/jmap sign in with a token too.

Work on it #

mise installs the toolchain, including bs, the Debug-mode compiler used for development builds, which also lints: mise install, then just setup for the baskingspot lint rules. just --list shows the recipes, and just ci builds parcel and runs the tests and lint. AGENTS.md has the conventions.

联系我们 contact @ memedata.com