📦 Chore: change mac package setting

This commit is contained in:
萌萌哒赫萝 2023-03-13 15:24:06 +08:00
parent 9fe24cd215
commit 17b7b1d294
3 changed files with 74 additions and 106 deletions

View File

@ -24,83 +24,80 @@ let contextMenu: Menu | null
let menu: Menu | null let menu: Menu | null
let tray: Tray | null let tray: Tray | null
export function createApplicationMenu () { export function createMenu () {
if (process.platform === 'darwin') { const submenu = buildPicBedListMenu()
const submenu = buildPicBedListMenu() const appMenu = Menu.buildFromTemplate([
const appMenu = Menu.buildFromTemplate([ {
{ label: 'PicList',
label: 'PicList', submenu: [
submenu: [ {
{ label: T('ABOUT'),
label: T('ABOUT'), click () {
click () { dialog.showMessageBox({
dialog.showMessageBox({ title: 'PicList',
title: 'PicList', message: 'PicList',
message: 'PicList', detail: `Version: ${pkg.version}\nAuthor: Kuingsmile\nGithub: https://github.com/Kuingsmile/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')
} }
] },
}, {
{ label: T('OPEN_MAIN_WINDOW'),
label: T('QUIT'), click () {
submenu: [ const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)
{ settingWindow!.show()
label: T('QUIT'), settingWindow!.focus()
role: 'quit' if (windowManager.has(IWindowList.MINI_WINDOW)) {
windowManager.get(IWindowList.MINI_WINDOW)!.hide()
}
} }
] },
} {
label: T('CHOOSE_DEFAULT_PICBED'),
]) type: 'submenu',
Menu.setApplicationMenu(appMenu) // @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 () { 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 toggleWindow = (bounds: IBounds) => {
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)! const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)!
if (trayWindow.isVisible()) { if (trayWindow.isVisible()) {

View File

@ -23,8 +23,7 @@ import {
uploadClipboardFiles uploadClipboardFiles
} from 'apis/app/uploader/apis' } from 'apis/app/uploader/apis'
import { import {
createTray, createTray
createApplicationMenu
} from 'apis/app/system' } from 'apis/app/system'
import server from '~/main/server/index' import server from '~/main/server/index'
import updateChecker from '~/main/utils/updateChecker' import updateChecker from '~/main/utils/updateChecker'
@ -91,7 +90,6 @@ class LifeCycle {
windowManager.create(IWindowList.TRAY_WINDOW) windowManager.create(IWindowList.TRAY_WINDOW)
windowManager.create(IWindowList.SETTING_WINDOW) windowManager.create(IWindowList.SETTING_WINDOW)
createTray() createTray()
createApplicationMenu()
db.set('needReload', false) db.set('needReload', false)
updateChecker() updateChecker()
// 不需要阻塞 // 不需要阻塞

View File

@ -72,7 +72,7 @@ const config = {
entitlementsInherit: 'build/entitlements.mas.inherit.plist', entitlementsInherit: 'build/entitlements.mas.inherit.plist',
provisioningProfile: 'build/piclistmass.provisionprofile', provisioningProfile: 'build/piclistmass.provisionprofile',
extendInfo: { extendInfo: {
LSUIElement: 1 LSUIElement: 0
}, },
target: [{ target: [{
target: 'mas', target: 'mas',