fix(electron): force GTK 3 on Linux to avoid GTK 2/3 vs GTK 4 crash

Enforce GTK 3 via app.commandLine switch on Linux to prevent mixed GTK symbol errors seen on Fedora AppImage.
This commit is contained in:
plebeius
2025-10-25 18:27:56 +02:00
parent dd08a3adff
commit 547fc4df81
+11
View File
@@ -16,6 +16,17 @@ const dirname = path.dirname(__filename);
// Load package.json dynamically
const packageJson = JSON.parse(fs.readFileSync(path.join(dirname, '../package.json'), 'utf-8'));
// Enforce GTK 3 on Linux to avoid mixing GTK 4 and GTK 3 in the same process
// which can happen on some distros/desktops and crashes AppImage with:
// "GTK 2/3 symbols detected. Using GTK 2/3 and GTK 4 in the same process is not supported"
if (process.platform === 'linux') {
try {
app.commandLine.appendSwitch('gtk-version', '3');
} catch (e) {
// ignore if unsupported, Electron will simply ignore this switch
}
}
let startIpfsError;
startIpfs.onError = (error) => {
// only show error once or it spams the user