Change default tray icon for macOS to avoid issues

This commit is contained in:
smartfrigde 2022-06-14 16:49:12 +02:00
parent c6e2244ce8
commit 8d85591e1c
3 changed files with 6 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -3,8 +3,13 @@ import {mainWindow} from "./window";
import {getConfig} from "./utils"; import {getConfig} from "./utils";
import * as path from "path"; import * as path from "path";
import {createSettingsWindow} from "./settings/main"; import {createSettingsWindow} from "./settings/main";
import {platform} from "process";
let tray: any = null; let tray: any = null;
let defaultIcon = "ac_plug_colored";
app.whenReady().then(async () => { app.whenReady().then(async () => {
if (platform == "darwin") {
defaultIcon = "macos"
}
if ((await getConfig("windowStyle")) == "discord") { if ((await getConfig("windowStyle")) == "discord") {
tray = new Tray(path.join(__dirname, "../", "/assets/dsc-tray.png")); tray = new Tray(path.join(__dirname, "../", "/assets/dsc-tray.png"));
const contextMenu = Menu.buildFromTemplate([ const contextMenu = Menu.buildFromTemplate([
@ -25,7 +30,7 @@ app.whenReady().then(async () => {
tray.setToolTip("Discord"); tray.setToolTip("Discord");
tray.setContextMenu(contextMenu); tray.setContextMenu(contextMenu);
} else { } else {
var trayIcon = (await getConfig("trayIcon")) ?? "ac_plug_colored"; var trayIcon = (await getConfig("trayIcon")) ?? defaultIcon;
tray = new Tray(path.join(__dirname, "../", `/assets/${trayIcon}.png`)); tray = new Tray(path.join(__dirname, "../", `/assets/${trayIcon}.png`));
const contextMenu = Menu.buildFromTemplate([ const contextMenu = Menu.buildFromTemplate([
{ {