Skip to content

fix: handle missing notification settings app on Linux#8304

Open
mvanhorn wants to merge 1 commit intoblock:mainfrom
mvanhorn:fix/8292-linux-notification-enoent
Open

fix: handle missing notification settings app on Linux#8304
mvanhorn wants to merge 1 commit intoblock:mainfrom
mvanhorn:fix/8292-linux-notification-enoent

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Apr 4, 2026

Summary

Fixes a crash when clicking "Open Settings" in Settings > App > Notifications on Linux desktops that don't have GNOME, KDE, or XFCE installed.

Changes

In ui/desktop/src/main.ts, the open-notifications-settings IPC handler used spawn() inside try/catch blocks for each desktop environment. Node.js spawn() does not throw synchronously on ENOENT; it emits the error asynchronously via the ChildProcess 'error' event. The try/catch blocks never fired, so the app crashed with spawn gnome-control-center ENOENT.

Fix: added a canSpawn(cmd) helper that uses execFileSync('which', [cmd]) to check if the binary exists before calling spawn(). Each DE check now uses if (canSpawn(...)) instead of try { spawn(...) } catch. When no settings app is found, returns false instead of crashing.

Testing

Verified the logic by reading the Node.js child_process docs confirming spawn() ENOENT behavior. The fix is a straightforward control flow change with no new dependencies.

Fixes #8292

This contribution was developed with AI assistance (Codex).

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop crash on Linux: Notifications "Open Settings" tries to spawn gnome-control-center (ENOENT)

1 participant