跳转到主内容

Tech Talk: How Electron went Wayland-native, and what it means for your apps

· 阅读时间:约 13 分钟
info

Tech talks are a new blog post series where we share glimpses into our work on Electron. If you find this work interesting, please consider contributing!

When Electron switched to Wayland on Linux last fall, most people didn't notice.

Major Linux distributions adopted the modern display protocol years ago, and both the KDE Plasma and GNOME desktop environments are in the process of dropping X11 support completely.

But a platform migration isn't complete without apps, and a large part of the Linux app ecosystem went through a second Wayland transition last August — well after most distros had changed their defaults. That's when Chromium turned on Wayland by default, bringing Electron and dozens of Linux desktop apps along with it.

Electron 41

· 阅读时间:约 7 分钟

Electron 41 has been released! It includes upgrades to Chromium 146.0.7680.65, V8 14.6, and Node v24.14.0.


The Electron team is excited to announce the release of Electron 41! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

info

After publishing the initial 41.0.0 package, we integrated some high-priority bugs into follow-up patch releases. We recommend installing 41.0.2 when upgrading to Electron 41.

重要变化

ASAR Integrity digest for improved security

As of Electron 41, macOS Electron apps can now embed a digest of their ASAR Integrity information. This adds an additional layer of tamper detection for apps that use ASAR Integrity by validating the integrity information itself at app launch.

To enable the feature for your app, you can run the following command with @electron/asar v4.1.0 and above:

asar integrity-digest on /path/to/YourApp.app

You must re-sign your app afterwards. For more information, see the @electron/asar CLI documentation.

Support for this feature in Electron Forge is planned for the near future (electron/forge#4159).

Improved Wayland support

On Wayland (Linux), frameless windows now have drop shadows and extended resize boundaries. To create fully frameless windows with no decorations, set hasShadow: false in the window constructor. #49885

Mitchell Cohen is writing a blog article about recent work to improve Electron's support of Wayland and client-side decorations on Linux. Watch this space!

Added support for MSIX auto-updating

The Electron team recently added MSIX auto-updater support according to RFC #21. You can now ship both MSIX and Squirrel.Mac in your update server essentially with the same JSON response format. See the autoUpdater documentation for more information.

This was added in Electron 41 by #49586 and has also been backported to Electron 39.5.0 (#49585) and 40.2.0 (#49587).

Electron 40.0.0

· 阅读时间:约 3 分钟

Electron 40.0.0 已发布! 它包括对 Chromium 144.0.7559.60、V8 14.4 和 Node 24.11.1 的升级。


Electron 团队很高兴发布了 Electron 40.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

Tech Talk: Improving Window Resize Behavior

· 阅读时间:约 16 分钟

We're launching a new blog post series where we share glimpses into our work on Electron. If you find this work interesting, please consider contributing!


Recently, I worked on improving Electron and Chromium's window resize behavior.

The bug

We were seeing an issue on Windows where old frames would become visible while resizing a window:

Animated GIF showing the issue where old frames would be shown while resizing windows

What made this bug particularly interesting?

  1. It was challenging.
  2. It was deep in a large codebase.
  3. As you'll see later, there were two different bugs under the hood.

Fixing the bug

With a bug like this, the first challenge is figuring out where to start looking.

Electron builds upon Chromium, the open source version of Google Chrome. When compiling Electron, Electron's source code is added into the Chromium source tree as a subdirectory. Electron then relies on Chromium's code to provide most of the functionality of a modern browser.

Chromium has about 36 million lines of code. Electron is a large project, too. That is a lot of code that could be causing this issue.

12月安静期(2025年12月)

· 阅读时间:约 3 分钟

Starting December 1, the Electron project will enter a quiet period before picking back up at full capacity in January 2026. For full details, see the Policies section below.

Since 2020, December has been a time for project maintainers to take a breather from regular maintenance duties in order to take a break or focus on heads-down work. This break helps us rest up and come back energized for the year to come.

That said, a month-long pause like this one is only achievable when an open-source project is in a healthy state—we’d like to thank all maintainers and external contributors for all of their continued efforts to keep the project moving. ❤️

Electron 39.0.0

· 阅读时间:约 5 分钟

Electron 39.0.0 已发布! 它包括对 Chromium 142.0.7444.52、V8 14.2 和 Node 22.20.0 的升级。


Electron 团队很高兴发布了 Electron 39.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

ASAR Integrity graduates to stable

A long-standing "experimental" feature -- ASAR integrity -- is now stable in Electron 39. When you enable this feature, it validates your packaged app.asar at runtime against a build-time hash to detect any tampering. 如果没有提供哈希值或者哈希值不一致,应用将会被强制终止运行。

See the ASAR integrity documentation for full information on how on the feature works, on how to use it in your application, and how to use it in Electron Forge and Electron Packager.

In related news, Electron Packager v19 now enables ASAR by default. #1841

Electron 38.0.0

· 阅读时间:约 5 分钟

Electron 38.0.0 已发布! 它包括对 Chromium 140.0.7339.41、V8 14.0 和 Node 22.16.0 的升级。


Electron 团队很高兴发布了 Electron 38.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

Electron 37.0.0

· 阅读时间:约 7 分钟

Electron 37.0.0 已发布! 它包括升级到 Chromium 138、V8 13.8 和 Node 22.16.0。


Electron 团队很高兴发布了 Electron 37.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

Google Summer of Code Begins

Our two Google Summer of Code contributors have started the program's coding period!

  • @nilayarya is crafting a new Save/Restore Window State API in Electron core. The new APIs will provide a built-in, standardized way to handle window state persistence. See Nilay's in-progress RFC at electron/rfcs#16.
  • @hitarth-gg is hard at work modernizing the long-dormant Devtron extension using Chrome Manifest V3 APIs. This project will provide tooling for developers to debug IPC communication, track event listeners, and visualize module dependencies in their Electron applications.

It has been an exciting couple of weeks for our GSOC participants, so stay tuned for more updates!

重要变化

Smooth Corners: Native CSS Squircles

An image showing different corner smoothing values (0%, 30%, 60%, and 100%) applied to rectangles, with 60% labeled as matching macOS style

Electron 37 introduces the custom -electron-corner-smoothing CSS property, which allows apps to create smoother rounded corners to match Apple's macOS design language. This feature originally landed in Electron 36, but we felt like it deserved a brighter spotlight.

Example with 100% Corner Smoothing

代码结果
.box {
width: 128px;
height: 128px;
border-radius: 24px;
-electron-corner-smoothing: 100%;
}

Unlike the standard border-radius property, which carves quarter-circle corners out of a rectangle, -electron-corner-smoothing smoothly transitions the curve into a squircle shape with a continuous perimeter.

You can adjust the smoothness using values from 0% to 100%, or use the system-ui value to match the operating system's style (60% on macOS and 0% otherwise). This design enhancement can be applied on borders, outlines, and shadows, giving your app a subtle layer of polish.

提示

Read more about Electron's squircle implementation in @clavin's RFC 0012. The document goes over the motivation and technical implementation in more detail.

The initial design drew inspiration from Figma's corner smoothing implementation. Read more about their own quest for smooth corners in "Desperately seeking squircles".

Electron 36.0.0

· 阅读时间:约 5 分钟

Electron 36.0.0 已发布! 它包括升级到 Chromium 136、V8 13.6 和 Node 22.14.0。


Electron 团队很高兴发布了 Electron 36.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

Writing Tools Support

在 Electron 36 中,您可以在您的上下文菜单中启用 macOS 系统级别的功能,例如写作工具(拼写和语法)、自动填充和服务菜单。 To do so, pass a WebFrameMain instance into the frame parameter for menu.popup().

import { BrowserWindow, Menu, WebFrameMain } from 'electron';

const currentWindow = BrowserWindow.getFocusedWindow();
const focusedFrame = currentWindow.webContents.focusedFrame;
const menu = Menu.buildFromTemplate([{ label: 'Copy', role: 'copy' }]);

menu.popup({
window: currentWindow,
frame: focusedFrame,
});

Electron 35.0.0

· 阅读时间:约 7 分钟

Electron 35.0.0 已发布! 它包括对 Chromium 134.0.6998.44、V8 13.5 和 Node 22.14.0 的升级。


Electron 团队很高兴发布了 Electron 35.0.0 ! 你可以通过 npm install electron@latest 或者从我们的发布网站下载它。 继续阅读此版本的详细信息。

如果您有任何反馈,请在 BlueskyMastodon 上与我们分享,或加入我们的 Discord 社区! Bug 和功能请求可以在 Electron 的问题跟踪器中报告。

重要变化

用于改进扩展支持的 Service Worker 预加载脚本

最初由 @samuelmaddockRFC #8 中提出,Electron 35 添加了将预加载脚本附加到 Service Workers 的功能。 由于 Chrome 的 Manifest V3 Extensions 通过 扩展 service workers 处理大量工作,该功能填补了 Electron 对现代 Chrome 扩展程序支持的空白。

在会话级别以编程方式注册预加载脚本时,现在可以使用 ses.registerPreloadScript(script) API 将其专门应用于 Service Worker 上下文。

Main Process
// 将我们的预加载脚本添加到会话中。
session.defaultSession.registerPreloadScript({
// 我们的脚本应该只在 service worker 预加载中运行。
type: 'service-worker',
// 脚本的绝对路径。
script: path.join(__dirname, 'extension-sw-preload.js'),
});

此外,现在可以通过 ServiceWorkerMain.ipc 类在 Service Workers 及其附加的预加载脚本之间进行 IPC 通信。 预加载脚本仍将使用 ipcRenderer 模块与其 Service Worker 进行通信。 请参阅原始 RFC 以了解更多详细信息。

此功能之前已经进行了许多其他更改,为其奠定了基础:

  • #45329 重新设计了 Session 模块的预加载 API,以支持注册和取消注册单独的预加载脚本。
  • #45229 添加了实验性的 contextBridge.executeInMainWorld(executionScript) 脚本,用于通过 context bridge 在 main world 中执行 JavaScript。
  • #45341 添加了 ServiceWorkerMain 类,用于与主进程中的 Service Workers 交互。