From 516bef1bf248584ddf2beca15ce25c339b3c2dc1 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Fri, 3 Apr 2026 20:31:27 -0700 Subject: [PATCH 1/2] fix: handle missing notification settings app on Linux Replace spawn() try/catch with canSpawn() check using execFileSync('which', [cmd]). Node.js spawn() emits ENOENT asynchronously via the error event, so try/catch never catches it. canSpawn() detects missing binaries before spawning. --- ui/desktop/src/main.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index 3fdf3a9724f4..b7fe256b9e2c 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -23,7 +23,7 @@ import fsSync from 'node:fs'; import started from 'electron-squirrel-startup'; import path from 'node:path'; import os from 'node:os'; -import { spawn } from 'child_process'; +import { execFileSync, spawn } from 'child_process'; import 'dotenv/config'; import { checkServerStatus } from './goosed'; import { startGoosed } from './goosed'; @@ -1442,38 +1442,40 @@ ipcMain.handle('open-notifications-settings', async () => { return true; } else if (process.platform === 'linux') { // Linux: Try different desktop environments + function canSpawn(cmd: string): boolean { + try { + execFileSync('which', [cmd], { stdio: 'ignore' }); + return true; + } catch { + return false; + } + } + // GNOME - try { + if (canSpawn('gnome-control-center')) { spawn('gnome-control-center', ['notifications']); return true; - } catch { - console.log('GNOME control center not found, trying other options'); } // KDE Plasma - try { + if (canSpawn('systemsettings5')) { spawn('systemsettings5', ['kcm_notifications']); return true; - } catch { - console.log('KDE systemsettings5 not found, trying other options'); } // XFCE - try { + if (canSpawn('xfce4-settings-manager')) { spawn('xfce4-settings-manager', ['--socket-id=notifications']); return true; - } catch { - console.log('XFCE settings manager not found, trying other options'); } // Fallback: Try to open general settings - try { + if (canSpawn('gnome-control-center')) { spawn('gnome-control-center'); return true; - } catch { - console.warn('Could not find a suitable settings application for Linux'); - return false; } + console.warn('Could not find a suitable settings application for Linux'); + return false; } else { console.warn( `Opening notification settings is not supported on platform: ${process.platform}` From 9a5d31de56da53fd6476c98d38d7d9e2a154ec90 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Wed, 8 Apr 2026 14:09:52 -0400 Subject: [PATCH 2/2] remove redundant gnome-control-center fallback check The first canSpawn('gnome-control-center') check already covers this case. If it wasn't found then, it won't be found again without args. Signed-off-by: Douwe Osinga --- ui/desktop/src/main.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index b7fe256b9e2c..2aa5cdce3f99 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -1469,11 +1469,6 @@ ipcMain.handle('open-notifications-settings', async () => { return true; } - // Fallback: Try to open general settings - if (canSpawn('gnome-control-center')) { - spawn('gnome-control-center'); - return true; - } console.warn('Could not find a suitable settings application for Linux'); return false; } else {