Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions electron/wayland.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ describe("Wayland startup configuration", () => {
};
configureWaylandSupport(commandLine, env);
expect(commandLine.appendSwitch).toHaveBeenCalledWith("ozone-platform", "wayland");
expect(commandLine.appendSwitch).toHaveBeenCalledWith("force-device-scale-factor", "1");
expect(commandLine.appendSwitch).toHaveBeenCalledWith("disable-features", "Vulkan");
});

Expand All @@ -28,13 +29,27 @@ describe("Wayland startup configuration", () => {
configureWaylandSupport(commandLine, { XDG_SESSION_TYPE: "wayland" });
expect(switches.get("ozone-platform")).toBe(platform);
expect(commandLine.appendSwitch).not.toHaveBeenCalledWith("ozone-platform", expect.anything());
expect(switches.get("force-device-scale-factor")).toBe(platform === "x11" ? undefined : "1");
// Capture still goes through PipeWire under Xwayland: X11 cannot see Wayland windows.
expect(commandLine.appendSwitch).toHaveBeenCalledWith(
"enable-features",
"WaylandWindowDrag,WebRTCPipeWireCapturer",
);
});

it("preserves an explicit device scale factor in a Wayland session", () => {
const commandLine = {
appendSwitch: vi.fn(),
hasSwitch: (name: string) => name === "force-device-scale-factor",
getSwitchValue: (name: string) => (name === "force-device-scale-factor" ? "1.25" : ""),
};
configureWaylandSupport(commandLine, { XDG_SESSION_TYPE: "wayland" });
expect(commandLine.appendSwitch).not.toHaveBeenCalledWith(
"force-device-scale-factor",
expect.anything(),
);
});

it("keeps the features passed on the command line (#1452)", () => {
// Chromium keeps only the last value of a repeated switch.
const switches = new Map([
Expand Down
11 changes: 11 additions & 0 deletions electron/wayland.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ export function configureWaylandSupport(commandLine: CommandLine, env: Env): voi
if (!commandLine.hasSwitch("ozone-platform")) {
commandLine.appendSwitch("ozone-platform", "wayland");
}
/*
* Chromium's unscaled Wayland size limits can clip the HUD with GTK text scaling.
* Electron 46 alpha has the fix; OpenScreen adoption may take 3–4 months (Nov 2026).
* TODO: Once we ship the fix for crbug.com/566940916, verify on Hyprland and remove.
*/
if (
usesWaylandBackend("linux", commandLine, env) &&
!commandLine.hasSwitch("force-device-scale-factor")
) {
commandLine.appendSwitch("force-device-scale-factor", "1");
}
// Enable WebRTCPipeWireCapturer for screen capture on Wayland
appendFeatures(commandLine, "enable-features", "WaylandWindowDrag,WebRTCPipeWireCapturer");
// Chromium's Wayland Ozone backend can't use Vulkan. When it tries, the WebRTC
Expand Down
Loading