From 4ca0d39008086c33bcb07d7ac0b73e6fceccbb25 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Thu, 2 Jan 2025 22:09:42 +0100 Subject: [PATCH 1/2] starting clientonly now checks for needed env var `WAYLAND_DISPLAY` or `DISPLAY` and starts electron with needed parameters --- CHANGELOG.md | 2 ++ clientonly/index.js | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b58882f6d..2ffea110cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ planned for 2025-04-01 ### Changed +- [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) + ### Removed ### Updated diff --git a/clientonly/index.js b/clientonly/index.js index 674355f810..4fe4758263 100644 --- a/clientonly/index.js +++ b/clientonly/index.js @@ -83,6 +83,17 @@ if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) { getServerConfig(`${prefix}${config.address}:${config.port}/config/`) .then(function (configReturn) { + // check environment for DISPLAY or WAYLAND_DISPLAY + const elecParams = ["js/electron.js"]; + if (process.env.WAYLAND_DISPLAY !== "") { + console.log(`Client: Using WAYLAND_DISPLAY=${process.env.WAYLAND_DISPLAY}`); + elecParams.push("--enable-features=UseOzonePlatform"); + elecParams.push("--ozone-platform=wayland"); + } else if (process.env.DISPLAY !== "") { + console.log(`Client: Using DISPLAY=${process.env.DISPLAY}`); + } else { + fail("Error: Requires environment variable WAYLAND_DISPLAY or DISPLAY, none is provided."); + } // Pass along the server config via an environment variable const env = Object.create(process.env); env.clientonly = true; // set to pass to electron.js @@ -94,7 +105,7 @@ // Spawn electron application const electron = require("electron"); - const child = require("node:child_process").spawn(electron, ["js/electron.js"], options); + const child = require("node:child_process").spawn(electron, elecParams, options); // Pipe all child process output to current stdout child.stdout.on("data", function (buf) { From 7fdc5c032f20451cb2d40121392222cd8c80b5f0 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Thu, 2 Jan 2025 22:44:20 +0100 Subject: [PATCH 2/2] fix electron tests --- .github/workflows/automated-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/automated-tests.yaml b/.github/workflows/automated-tests.yaml index f6dc940b08..f75e17b3d0 100644 --- a/.github/workflows/automated-tests.yaml +++ b/.github/workflows/automated-tests.yaml @@ -34,7 +34,7 @@ jobs: npm run test:css npm run test:markdown test: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 30 strategy: matrix: