diff --git a/src/main/apis/app/system/index.ts b/src/main/apis/app/system/index.ts index bebafc3..7fe1119 100644 --- a/src/main/apis/app/system/index.ts +++ b/src/main/apis/app/system/index.ts @@ -24,83 +24,80 @@ let contextMenu: Menu | null let menu: Menu | null let tray: Tray | null -export function createApplicationMenu () { - if (process.platform === 'darwin') { - const submenu = buildPicBedListMenu() - const appMenu = Menu.buildFromTemplate([ - { - label: 'PicList', - submenu: [ - { - label: T('ABOUT'), - click () { - dialog.showMessageBox({ - title: 'PicList', - message: 'PicList', - detail: `Version: ${pkg.version}\nAuthor: Kuingsmile\nGithub: https://github.com/Kuingsmile/PicList` - }) - } - }, - { - label: T('OPEN_MAIN_WINDOW'), - click () { - const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW) - settingWindow!.show() - settingWindow!.focus() - if (windowManager.has(IWindowList.MINI_WINDOW)) { - windowManager.get(IWindowList.MINI_WINDOW)!.hide() - } - } - }, - { - label: T('CHOOSE_DEFAULT_PICBED'), - type: 'submenu', - // @ts-ignore - submenu - }, - // @ts-ignore - { - label: T('OPEN_UPDATE_HELPER'), - type: 'checkbox', - checked: db.get('settings.showUpdateTip'), - click () { - const value = db.get('settings.showUpdateTip') - db.set('settings.showUpdateTip', !value) - } - }, - { - label: T('PRIVACY_AGREEMENT'), - click () { - privacyManager.show(false) - } - }, - { - label: T('RELOAD_APP'), - click () { - app.relaunch() - app.exit(0) - } - }, - // @ts-ignore - { - role: 'quit', - label: T('QUIT') +export function createMenu () { + const submenu = buildPicBedListMenu() + const appMenu = Menu.buildFromTemplate([ + { + label: 'PicList', + submenu: [ + { + label: T('ABOUT'), + click () { + dialog.showMessageBox({ + title: 'PicList', + message: 'PicList', + detail: `Version: ${pkg.version}\nAuthor: Kuingsmile\nGithub: https://github.com/Kuingsmile/PicList` + }) } - ] - }, - { - label: T('QUIT'), - submenu: [ - { - label: T('QUIT'), - role: 'quit' + }, + { + label: T('OPEN_MAIN_WINDOW'), + click () { + const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW) + settingWindow!.show() + settingWindow!.focus() + if (windowManager.has(IWindowList.MINI_WINDOW)) { + windowManager.get(IWindowList.MINI_WINDOW)!.hide() + } } - ] - } - - ]) - Menu.setApplicationMenu(appMenu) - } + }, + { + label: T('CHOOSE_DEFAULT_PICBED'), + type: 'submenu', + // @ts-ignore + submenu + }, + // @ts-ignore + { + label: T('OPEN_UPDATE_HELPER'), + type: 'checkbox', + checked: db.get('settings.showUpdateTip'), + click () { + const value = db.get('settings.showUpdateTip') + db.set('settings.showUpdateTip', !value) + } + }, + { + label: T('PRIVACY_AGREEMENT'), + click () { + privacyManager.show(false) + } + }, + { + label: T('RELOAD_APP'), + click () { + app.relaunch() + app.exit(0) + } + }, + // @ts-ignore + { + role: 'quit', + label: T('QUIT') + } + ] + }, + { + label: T('QUIT'), + submenu: [ + { + label: T('QUIT'), + role: 'quit' + } + ] + } + ]) + Menu.setApplicationMenu(appMenu) } export function createContextMenu () { @@ -330,33 +327,6 @@ export function createTray () { } } -export function createMenu () { - if (process.env.NODE_ENV !== 'development') { - const template = [{ - label: 'Edit', - submenu: [ - { label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' }, - { label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:' }, - { type: 'separator' }, - { label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:' }, - { label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:' }, - { label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:' }, - { label: 'Select All', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:' }, - { - label: 'Quit', - accelerator: 'CmdOrCtrl+Q', - click () { - app.quit() - } - } - ] - }] - // @ts-ignore - menu = Menu.buildFromTemplate(template) - Menu.setApplicationMenu(menu) - } -} - const toggleWindow = (bounds: IBounds) => { const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)! if (trayWindow.isVisible()) { diff --git a/src/main/lifeCycle/index.ts b/src/main/lifeCycle/index.ts index 50074d0..348744a 100644 --- a/src/main/lifeCycle/index.ts +++ b/src/main/lifeCycle/index.ts @@ -23,8 +23,7 @@ import { uploadClipboardFiles } from 'apis/app/uploader/apis' import { - createTray, - createApplicationMenu + createTray } from 'apis/app/system' import server from '~/main/server/index' import updateChecker from '~/main/utils/updateChecker' @@ -91,7 +90,6 @@ class LifeCycle { windowManager.create(IWindowList.TRAY_WINDOW) windowManager.create(IWindowList.SETTING_WINDOW) createTray() - createApplicationMenu() db.set('needReload', false) updateChecker() // 不需要阻塞 diff --git a/vue.config.js b/vue.config.js index 08e2628..d1d18d7 100644 --- a/vue.config.js +++ b/vue.config.js @@ -72,7 +72,7 @@ const config = { entitlementsInherit: 'build/entitlements.mas.inherit.plist', provisioningProfile: 'build/piclistmass.provisionprofile', extendInfo: { - LSUIElement: 1 + LSUIElement: 0 }, target: [{ target: 'mas',