fixed macos tray display bugs

This commit is contained in:
MrGarlic1 2024-05-06 11:48:05 -04:00 committed by GitHub
parent f525e541d6
commit 37c3259171
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -121,10 +121,14 @@ function initTray(win: BrowserWindow) {
}
}
]);
tray = new Tray(ICON_PATH);
if (Settings.store.trayIconPath) {
const trayImage = nativeImage.createFromPath(Settings.store.trayIconPath);
if (!trayImage.isEmpty()) tray.setImage(trayImage.resize({ width: 32, height: 32 }));
var trayImage = nativeImage.createFromPath(ICON_PATH);
if (Settings.store.trayIconPath) trayImage = nativeImage.createFromPath(Settings.store.trayIconPath);
if (trayImage.isEmpty()) trayImage = nativeImage.createFromPath(ICON_PATH);
if (process.platform === "darwin") {
tray = new Tray(trayImage.resize({ width: 16, height: 16 }));
} else {
tray = new Tray(trayImage.resize({ width: 32, height: 32 }));
}
tray.setToolTip("Vesktop");
@ -433,7 +437,7 @@ function createMainWindow() {
if (Settings.store.staticTitle) win.on("page-title-updated", e => e.preventDefault());
initWindowBoundsListeners(win);
if (!isDeckGameMode && (Settings.store.tray ?? true) && process.platform !== "darwin") initTray(win);
if (!isDeckGameMode && (Settings.store.tray ?? true)) initTray(win);
initMenuBar(win);
makeLinksOpenExternally(win);
initSettingsListeners(win);