fix: resolve Arch Linux defunct process and tray issues by hardening sandbox permissions and environment flags

This commit is contained in:
2026-02-21 14:43:59 +01:00
parent 8f18e05a10
commit c1fd7cee49
2 changed files with 22 additions and 16 deletions

View File

@@ -94,22 +94,25 @@ const initBackend = () => {
// --- System Tray ---
const createTray = () => {
const possiblePaths = [
'/usr/share/pixmaps/ultimate-ban-tracker.png', // System installed (highest priority)
path.join(__dirname, '..', 'assets-build', 'icon.png'),
path.join(__dirname, '..', 'assets-build', 'icon.svg'),
'/usr/share/pixmaps/ultimate-ban-tracker.png', // System installed
path.join(process.resourcesPath, 'assets-build', 'icon.png'),
path.join(app.getAppPath(), 'assets-build', 'icon.png')
path.join(app.getAppPath(), 'assets-build', 'icon.png'),
path.join(__dirname, '..', 'assets-build', 'icon.png')
];
let iconPath = '';
for (const p of possiblePaths) {
if (fs.existsSync(p)) { iconPath = p; break; }
if (p && fs.existsSync(p)) { iconPath = p; break; }
}
console.log(`[Tray] Resolved icon path: ${iconPath || 'NONE FOUND'}`);
console.log(`[Tray] Attempting to initialize with icon: ${iconPath || 'NONE FOUND'}`);
if (!iconPath) {
console.warn(`[Tray] FAILED: No valid icon found.`);
// Fallback to a native empty icon just to avoid crashing if possible
try {
tray = new Tray(nativeImage.createEmpty());
} catch (e) {}
return;
}
@@ -118,19 +121,18 @@ const createTray = () => {
tray = new Tray(icon);
tray.setToolTip('Ultimate Ban Tracker');
// Linux Fix: Some DEs need this to show the menu correctly
if (process.platform === 'linux') {
tray.setIgnoreMouseEvents(false);
}
tray.on('click', () => { if (mainWindow) { mainWindow.show(); mainWindow.focus(); } });
// Load initial themed icon if possible
// Force initial menu build
updateTrayMenu();
const config = store.get('serverConfig');
if (config?.theme) {
setAppIcon(config.theme);
} else {
updateTrayMenu();
}
console.log(`[Tray] Successfully initialized`);
} catch (e: any) {