fix: resolve Arch Linux defunct process and tray issues by hardening sandbox permissions and environment flags
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user