From 173dac3ce956ab84760c8d085b20854ea4256dea Mon Sep 17 00:00:00 2001 From: vodyanoysh Date: Thu, 30 Apr 2026 08:11:04 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=B8=D0=BA=D0=BE=D0=BD=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=B8=20=D0=BE=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20.desktop?= =?UTF-8?q?=20=D0=BF=D1=80=D0=B8=20=D0=BA=D0=B0=D0=B6=D0=B4=D0=BE=D0=BC=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=83=D1=81=D0=BA=D0=B5=20=D0=BD=D0=B0=20Lin?= =?UTF-8?q?ux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setupLinuxIntegration() при старте packaged-сборки: - копирует icon.png из resourcesPath в hicolor (512/256/128) - удаляет все appimagekit_*Aero_Mail.desktop - пишет чистый aero-mail.desktop с Icon=aero-mail Решает проблему устаревшей/отсутствующей иконки без ожидания обновления. Co-Authored-By: Claude Sonnet 4.6 --- src/main/index.ts | 51 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/src/main/index.ts b/src/main/index.ts index d949636..93bc3fa 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,6 +1,7 @@ import { app, BrowserWindow, shell, ipcMain, dialog, Menu, globalShortcut, clipboard } from 'electron' import { join, basename } from 'node:path' -import { statSync } from 'node:fs' +import { statSync, mkdirSync, copyFileSync, writeFileSync, readdirSync, unlinkSync, existsSync } from 'node:fs' +import { homedir } from 'node:os' import { AccountManager } from './services/account-manager' import { registerAccountHandlers } from './ipc/accounts.handler' import { registerFolderHandlers } from './ipc/folders.handler' @@ -142,7 +143,55 @@ ipcMain.handle('app:copyToClipboard', (_event, { text }: { text: string }) => { clipboard.writeText(text) }) +function setupLinuxIntegration(): void { + if (process.platform !== 'linux' || !app.isPackaged) return + + const home = homedir() + const appImagePath = process.env['APPIMAGE'] ?? '' + + // Копируем иконку из ресурсов AppImage в hicolor-тему + const srcIcon = join(process.resourcesPath, 'icon.png') + if (existsSync(srcIcon)) { + for (const size of ['512x512', '256x256', '128x128']) { + const dir = join(home, `.local/share/icons/hicolor/${size}/apps`) + mkdirSync(dir, { recursive: true }) + copyFileSync(srcIcon, join(dir, 'aero-mail.png')) + } + } + + // Удаляем старые записи AppImageLauncher + const appsDir = join(home, '.local/share/applications') + mkdirSync(appsDir, { recursive: true }) + try { + for (const f of readdirSync(appsDir)) { + if (/^appimagekit_.*Aero_Mail\.desktop$/.test(f)) { + unlinkSync(join(appsDir, f)) + } + } + } catch (_) {} + + // Пишем чистый desktop-файл + if (appImagePath) { + writeFileSync( + join(appsDir, 'aero-mail.desktop'), + [ + '[Desktop Entry]', + 'Name=Aero Mail', + `Exec=${appImagePath} --no-sandbox %U`, + 'Terminal=false', + 'Type=Application', + 'Icon=aero-mail', + 'StartupWMClass=Aero Mail', + 'Comment=Desktop email client built with Vue 3 + Electron', + 'Categories=Network;', + '', + ].join('\n'), + ) + } +} + app.whenReady().then(async () => { + setupLinuxIntegration() await accountManager.initialize() // Register all IPC handlers