fix: update tray icon path for windows and improve tray behavior (#1511)

This commit is contained in:
Whitewater
2024-11-09 00:22:17 +08:00
committed by GitHub
parent 9a5affcead
commit 3706874e42
3 changed files with 5 additions and 3 deletions
+4 -1
View File
@@ -1,10 +1,13 @@
import path from "node:path"
import { fileURLToPath } from "node:url"
import { isMacOS } from "./env"
const __dirname = fileURLToPath(new URL(".", import.meta.url))
const iconMap = {
prod: path.join(__dirname, "../../resources/icon.png"),
dev: path.join(__dirname, "../../static/icon-dev.png"),
}
export const getIconPath = () => iconMap[process.env.NODE_ENV === "development" ? "dev" : "prod"]
export const getTrayIconPath = () => path.join(__dirname, "../../resources/tray-icon.png")
export const getTrayIconPath = () =>
isMacOS ? path.join(__dirname, "../../resources/tray-icon.png") : getIconPath()
+1 -1
View File
@@ -44,7 +44,7 @@ function bootstrap() {
app.on("second-instance", (_, commandLine) => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
mainWindow.show()
}
const url = commandLine.pop()
-1
View File
@@ -38,7 +38,6 @@ export const registerAppTray = () => {
const showWindow = () => {
const mainWindow = getMainWindowOrCreate()
if (!mainWindow) return
if (mainWindow.isMinimized()) {
mainWindow.restore()
} else {