Skip to content

Commit 0f6efac

Browse files
authored
clientonly and wayland, hotfix electron tests (#3677)
clientonly: - did work only with xserver and `DISPLAY` env var - now checks for `WAYLAND_DISPLAY` or `DISPLAY` env var before running - if `WAYLAND_DISPLAY` is set now starts with wayland parameters electron tests see #3676
1 parent 75dbe67 commit 0f6efac

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.github/workflows/automated-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
npm run test:css
3535
npm run test:markdown
3636
test:
37-
runs-on: ubuntu-latest
37+
runs-on: ubuntu-22.04
3838
timeout-minutes: 30
3939
strategy:
4040
matrix:

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ planned for 2025-04-01
1717

1818
### Changed
1919

20+
- [core] starting clientonly now checks for needed env var `WAYLAND_DISPLAY` or `DISPLAY` and starts electron with needed parameters (if both are set wayland is used)
21+
2022
### Removed
2123

2224
### Updated

clientonly/index.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@
8383
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
8484
getServerConfig(`${prefix}${config.address}:${config.port}/config/`)
8585
.then(function (configReturn) {
86+
// check environment for DISPLAY or WAYLAND_DISPLAY
87+
const elecParams = ["js/electron.js"];
88+
if (process.env.WAYLAND_DISPLAY !== "") {
89+
console.log(`Client: Using WAYLAND_DISPLAY=${process.env.WAYLAND_DISPLAY}`);
90+
elecParams.push("--enable-features=UseOzonePlatform");
91+
elecParams.push("--ozone-platform=wayland");
92+
} else if (process.env.DISPLAY !== "") {
93+
console.log(`Client: Using DISPLAY=${process.env.DISPLAY}`);
94+
} else {
95+
fail("Error: Requires environment variable WAYLAND_DISPLAY or DISPLAY, none is provided.");
96+
}
8697
// Pass along the server config via an environment variable
8798
const env = Object.create(process.env);
8899
env.clientonly = true; // set to pass to electron.js
@@ -94,7 +105,7 @@
94105

95106
// Spawn electron application
96107
const electron = require("electron");
97-
const child = require("node:child_process").spawn(electron, ["js/electron.js"], options);
108+
const child = require("node:child_process").spawn(electron, elecParams, options);
98109

99110
// Pipe all child process output to current stdout
100111
child.stdout.on("data", function (buf) {

0 commit comments

Comments
 (0)