Skip to content

Commit

Permalink
托盘和窗口优化
Browse files Browse the repository at this point in the history
  • Loading branch information
xianyunleo committed Feb 1, 2024
1 parent 383e48e commit 379c9a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/main/MainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ export default class MainWindow {
}

static show() {
if (this.#instance.isMinimized()) this.#instance.restore()
this.#instance.show()
this.#instance.isMinimized() ? this.#instance.restore() : this.#instance.show()
}

}
6 changes: 4 additions & 2 deletions src/main/TrayManage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { electronRequireMulti } from '@/main/utils/electron'
import { APP_NAME } from '@/shared/utils/constant'
const { app, Tray, Menu, nativeImage, getGlobal } = electronRequireMulti()
import { isMacOS } from '@/main/utils/utils'
import { isMacOS, isWindows } from '@/main/utils/utils'
import {t} from '@/shared/utils/i18n'
import Path from '@/main/utils/Path'
import GetAppPath from '@/main/utils/GetAppPath'
Expand All @@ -16,7 +16,9 @@ export default class TrayManage {
const contextMenu = this.getContextMenu();
tray.setToolTip(APP_NAME)
tray.setContextMenu(contextMenu)
tray.on('click', () => this.showMainWindow())
if (isWindows) {
tray.on('click', () => this.showMainWindow())
}
this.#_instance = tray;
}

Expand Down

0 comments on commit 379c9a1

Please sign in to comment.