diff --git a/changelog.md b/changelog.md index e2af67ed..da1d87bb 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,8 @@ +## v0.0.13 + +- 优化:Mac 系统下全屏不能退出问题 +- 优化:Mac 系统下隐藏窗口自动隐藏图标 + ## v0.0.12 - 新增:日志目录一键打开,方便查看日志 diff --git a/electron/config/tray.ts b/electron/config/tray.ts index b7de1f19..a1b8c071 100644 --- a/electron/config/tray.ts +++ b/electron/config/tray.ts @@ -3,15 +3,21 @@ import {trayPath} from "./icon"; import {AppRuntime} from "../mapi/env"; import {AppConfig} from "../../src/config"; import {t} from "./lang"; -import {isWin} from "../lib/env"; +import {isMac, isWin} from "../lib/env"; let tray = null const showApp = () => { + if (isMac) { + app.dock.show() + } AppRuntime.mainWindow.show() } const hideApp = () => { + if (isMac) { + app.dock.hide() + } AppRuntime.mainWindow.hide() } @@ -20,9 +26,6 @@ const quitApp = () => { } const ready = () => { - if (process.platform === 'darwin') { - app.dock.show() - } tray = new Tray(trayPath) tray.setToolTip(AppConfig.name) diff --git a/electron/mapi/app/main.ts b/electron/mapi/app/main.ts index f1d61d5a..e9e078b4 100644 --- a/electron/mapi/app/main.ts +++ b/electron/mapi/app/main.ts @@ -1,6 +1,7 @@ import {app, ipcMain, shell} from "electron"; import {WindowConfig} from "../../config/window"; import {AppRuntime} from "../env"; +import {isMac} from "../../lib/env"; const quit = () => { app.quit() @@ -11,7 +12,11 @@ const windowMin = () => { } const windowMax = () => { - if (AppRuntime.mainWindow.isMaximized()) { + if (AppRuntime.mainWindow.isFullScreen()) { + AppRuntime.mainWindow.setFullScreen(false) + AppRuntime.mainWindow.unmaximize() + AppRuntime.mainWindow.center() + } else if (AppRuntime.mainWindow.isMaximized()) { AppRuntime.mainWindow.unmaximize() AppRuntime.mainWindow.center() } else { @@ -58,6 +63,9 @@ ipcMain.handle('window:hide', (event, name: string) => { } else { AppRuntime.windows[name]?.hide() } + if (isMac) { + app.dock.hide() + } }) export default {