Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions ui/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -1442,38 +1442,35 @@ 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' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove hard dependency on which for command detection

The new Linux path now relies on execFileSync('which', [cmd]) to decide whether a settings binary exists, but which is not guaranteed to be installed on all Linux desktops. In environments where gnome-control-center/systemsettings5 exists but which is missing, canSpawn returns false for every check and this handler will incorrectly fail instead of opening settings, which is a behavior regression introduced by this change.

Useful? React with 👍 / 👎.

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 {
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}`
Expand Down
Loading