build(electron): upgrade to Electron 39 with X11 default on Linux

Upgrade Electron from 37.7.0 to 39.2.5. Since Electron 38+ defaults to
Wayland via --ozone-platform=auto, force X11 on Linux to ensure reliable
idle detection (#1443) and global shortcuts. Users can opt-in to Wayland
with --ozone-platform=wayland or --force-wayland flags.
This commit is contained in:
Johannes Millan 2025-12-05 15:19:12 +01:00
parent c5e4f1beee
commit 68ff0ffb88
4 changed files with 21 additions and 6 deletions

View file

@ -73,6 +73,21 @@ export const startApp = (): void => {
// https://github.com/electron/electron/issues/46538#issuecomment-2808806722
app.commandLine.appendSwitch('gtk-version', '3');
// Force X11 on Linux by default (Electron 38+ defaults to Wayland via --ozone-platform=auto)
// Wayland has known issues:
// - Idle detection fallbacks are unreliable (#1443)
// - Global shortcuts require manual system configuration (GlobalShortcutsPortal)
// Users can override with --ozone-platform=wayland if desired
if (process.platform === 'linux') {
const forceWayland = process.argv.some(
(arg) =>
arg.includes('--ozone-platform=wayland') || arg.includes('--force-wayland'),
);
if (!forceWayland) {
app.commandLine.appendSwitch('ozone-platform', 'x11');
}
}
// NOTE: needs to be executed before everything else
process.argv.forEach((val) => {
if (val && val.includes('--disable-tray')) {

8
package-lock.json generated
View file

@ -90,7 +90,7 @@
"core-js": "^3.39.0",
"cross-env": "^7.0.3",
"detect-it": "^4.0.1",
"electron": "37.7.0",
"electron": "39.2.5",
"electron-builder": "^26.3.3",
"eslint": "^8.57.1",
"eslint-config-prettier": "^10.1.5",
@ -13982,9 +13982,9 @@
}
},
"node_modules/electron": {
"version": "37.7.0",
"resolved": "https://registry.npmjs.org/electron/-/electron-37.7.0.tgz",
"integrity": "sha512-LBzvfrS0aalynOsnC11AD7zeoU8eOois090mzLpQM3K8yZ2N04i2ZW9qmHOTFLrXlKvrwRc7EbyQf1u8XHMl6Q==",
"version": "39.2.5",
"resolved": "https://registry.npmjs.org/electron/-/electron-39.2.5.tgz",
"integrity": "sha512-LXlOcH3CNopcVTQWjp680fMygdNrWKdIe3hyMtlyceO+Jd0b2hdMw1iWz36I+UUXHXPH87i937gXYi0jze2fCw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",

View file

@ -205,7 +205,7 @@
"core-js": "^3.39.0",
"cross-env": "^7.0.3",
"detect-it": "^4.0.1",
"electron": "37.7.0",
"electron": "39.2.5",
"electron-builder": "^26.3.3",
"eslint": "^8.57.1",
"eslint-config-prettier": "^10.1.5",

View file

@ -1 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,gEAAgE;;;AAShE,IAAY,WAWX;AAXD,WAAY,WAAW;IACrB,6CAA8B,CAAA;IAC9B,yCAA0B,CAAA;IAC1B,yCAA0B,CAAA;IAC1B,wDAAyC,CAAA;IACzC,uCAAwB,CAAA;IACxB,iDAAkC,CAAA;IAClC,4DAA6C,CAAA;IAC7C,gCAAiB,CAAA;IACjB,gDAAiC,CAAA;IACjC,wDAAyC,CAAA;AAC3C,CAAC,EAXW,WAAW,2BAAX,WAAW,QAWtB;AAseD;;;GAGG;AACH,IAAY,uBAoBX;AApBD,WAAY,uBAAuB;IACjC,oBAAoB;IACpB,uDAA4B,CAAA;IAC5B,+DAAoC,CAAA;IACpC,yDAA8B,CAAA;IAE9B,cAAc;IACd,2DAAgC,CAAA;IAEhC,qBAAqB;IACrB,6EAAkD,CAAA;IAClD,mFAAwD,CAAA;IAExD,qBAAqB;IACrB,qDAA0B,CAAA;IAC1B,uEAA4C,CAAA;IAC5C,iEAAsC,CAAA;IAEtC,mBAAmB;IACnB,iDAAsB,CAAA;AACxB,CAAC,EApBW,uBAAuB,uCAAvB,uBAAuB,QAoBlC;AAED,6CAA6C;AAC7C,2EAA2E;AAC3E,mBAAmB;AACnB,uBAAuB;AACvB,4BAA4B;AAC5B,MAAM;AACN,EAAE;AACF,uDAAuD;AACvD,gCAAgC;AAChC,IAAI"}
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1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