我错怪了 Electron
When I started building Paseo, I picked Tauri.
刚开始做 Paseo 的时候,我选的是 Tauri。
The reasoning felt obvious at the time. I was building a desktop app with a web UI, and I cared about shipping something that did not feel bloated. Like a lot of developers, I had also internalized the idea that Electron was the bad option.
当时觉得理由再明显不过。我要做的是一个用 Web 写界面的桌面应用,而且很在意做出来的东西别显得臃肿。再加上跟很多开发者一样,「Electron 是个烂选项」这个念头早就刻进我脑子里了。
Tauri had all the right stuff: Rust, small binaries, native webviews, lower memory usage. It felt like the better choice.
Tauri 的卖点样样都对:Rust、二进制小、用系统原生的 webview、内存占用低。怎么看都是更好的那个。
I also kept seeing "Built with Tauri" on product landing pages, and I think that influenced me more than I realized. It made Tauri feel like what the cool kids were using.
我还老在各种产品的落地页上看到「Built with Tauri」,现在想来,它对我的影响比我自己意识到的要大。它让 Tauri 看起来就是酷小孩们都在用的东西。
I thought I knew better than all those other Electron apps. At first, it felt like I was right. On macOS, the app was small, the UI worked well, and the bundle size made me feel good about myself.
我以为自己比那些 Electron 应用都高明。一开始好像也确实如此。在 macOS 上,应用体积小,界面跑得好好的,看着那个包体大小,我挺得意。
Getting the app working on Windows was not a problem. Tauri uses WebView2 there, which is Chromium-based, so the app behaved close enough to what I expected. There were platform quirks to deal with, but nothing specific to Tauri.
在 Windows 上跑起来也没遇到什么问题。Tauri 在那边用的是 WebView2,内核是 Chromium,所以应用的表现和我预想的差不多。平台本身的怪毛病有一些,但都不是 Tauri 特有的。
Linux is where things started getting complicated.
到了 Linux,事情开始变复杂。
Tauri does not bundle one browser engine across platforms. That is the point. On Linux, it relies on WebKitGTK, which sounds elegant until you are debugging rendering behavior across distros, GPU setups, and Wayland/X11 differences.
Tauri 不会在各个平台上捆同一个浏览器引擎,这本来就是它的设计初衷。在 Linux 上它靠的是 WebKitGTK。听上去很优雅,直到你开始在不同发行版、不同 GPU 配置、Wayland 和 X11 的差异之间排查渲染问题。
For Paseo, this turned into a lot of product work I did not want to be doing. The WebKitGTK bindings Tauri was using were too old. Wayland had problems. And once I got the app running, it just looked different. It was not just small stuff like font weights or aliasing, some screens had real layout differences.
对 Paseo 来说,这变成了一大堆我根本不想干的产品活。Tauri 用的 WebKitGTK 绑定太老了,Wayland 下有问题。好不容易跑起来了,界面看着就是不一样。还不只是字重、抗锯齿这种小地方,有些页面的布局是真的不一样。
I could maybe have lived with all of this, but then I started implementing notifications.
这些我咬咬牙也许还能忍,可后来我开始做通知了。
For Paseo, notifications are not a nice to have. If an agent finishes, fails, or needs attention, I want the user to click the notification and land in the right place.
对 Paseo 来说,通知不是可有可无的点缀。agent 跑完了、失败了、或者需要人看一眼,我希望用户点一下通知就直接落到对应的地方。
Tauri's notification plugin can show notifications, but desktop click handling was not there in the way I needed. There's something called the Actions API that allows you to attach callbacks to notifications, but the docs mark it as mobile-only, which was strange.
Tauri 的通知插件能把通知弹出来,但桌面端的点击处理达不到我要的样子。倒是有个叫 Actions API 的东西,能给通知挂回调,可文档上标着「仅限移动端」,挺奇怪的。
This made me notice that Tauri was expanding into mobile apps, it was hard not to feel some doubt. I was still fighting basic desktop product issues while the framework was moving into something else entirely.
我这才注意到 Tauri 在往移动端扩张,心里很难不犯嘀咕。我这边还在跟桌面端的基础问题较劲,框架却已经奔着完全不同的方向去了。
I tried a bunch of Rust crates, but none of them worked the way I wanted, so I ended up having to write the notification handling per platform. It was not straightforward, and now I had to maintain it.
我试了一堆 Rust crate,没有一个能按我想要的方式工作,最后只好每个平台单独写一套通知处理。写起来不简单,写完了还得自己维护。
There was also the daemon. This part is not really Tauri's fault, but it pushed me further toward Electron.
还有守护进程(daemon)的事。这部分其实怪不到 Tauri 头上,但它又把我往 Electron 那边推了一把。
Paseo has a Node.js daemon, and I wanted a one-click experience. Download the app, open it, and go. I did not want to tell users "go run this command first" or teach them what a "daemon" was.
Paseo 有一个 Node.js 写的守护进程,而我想要的是一键即用:下载、打开、开干。我不想跟用户说「先去跑一下这条命令」,也不想给他们讲什么叫「守护进程」。
Tauri supports sidecars, so I got the daemon bundled and it worked. But it became its own project: different binaries for different platforms and target triples, packaging details, permissions, process spawning, paths, upgrades.
Tauri 支持 sidecar,所以我把守护进程打包了进去,也能跑。但这件事自己就成了一个项目:不同平台、不同 target triple 各一份二进制,还有打包细节、权限、进程启动、路径、升级。
At some point I had the realization that I was building Electron with extra steps.
到某个时候我突然反应过来:我这是在绕远路,亲手再造一个 Electron。
So I decided to try Electron. The migration was a bit of a pain, but I got things working surprisingly fast, and after a week of solid work Paseo actually felt lighter and simpler. The UI looked the same across platforms. Notifications behaved the way I needed. The daemon was simpler since it had Node pre-bundled.
于是我决定试试 Electron。迁移是有点折腾,但东西跑起来的速度快得出乎意料,扎扎实实干了一周之后,Paseo 反而感觉更轻、更简单了。各平台上的界面一模一样,通知的行为正是我要的,守护进程也简单了,因为 Node 本来就打包在里面。
Overall, I have been really happy with Electron since. It mostly gets out of my way. And when there are performance problems, they tend to come from my application code rather than Electron itself. I guess that is also why Electron gets a bad reputation, it is really easy to make a bloated Electron app.
总的来说,从那以后我对 Electron 一直很满意。它大多数时候不碍事。真出了性能问题,往往也是我自己的应用代码造成的,而不是 Electron 本身。我猜这也是 Electron 名声不好的原因:做出一个臃肿的 Electron 应用实在太容易了。
My conclusion here is not that Tauri is bad. It was just the wrong choice for Paseo, and I made that choice more by vibes than by looking at the tradeoffs objectively.
我的结论不是 Tauri 不好。它只是不适合 Paseo,而我当初做这个选择,更多是凭感觉,没有客观地去权衡利弊。