mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-08-28 11:36:58 +08:00
✨ Feature: add appMenu, replace icon
This commit is contained in:
@@ -22,6 +22,12 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.cs.disable-library-validation</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.device.usb</key>
|
||||||
|
<true/>
|
||||||
<key>com.apple.security.network.server</key>
|
<key>com.apple.security.network.server</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 541 B After Width: | Height: | Size: 639 B |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 645 B |
@@ -23,6 +23,86 @@ import { buildPicBedListMenu } from '~/main/events/remotes/menu'
|
|||||||
let contextMenu: Menu | null
|
let contextMenu: Menu | null
|
||||||
let menu: Menu | null
|
let menu: Menu | null
|
||||||
let tray: Tray | null
|
let tray: Tray | null
|
||||||
|
|
||||||
|
export function createApplicationMenu () {
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
const submenu = buildPicBedListMenu()
|
||||||
|
contextMenu = 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')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: T('QUIT'),
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: T('QUIT'),
|
||||||
|
role: 'quit'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
])
|
||||||
|
Menu.setApplicationMenu(contextMenu)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function createContextMenu () {
|
export function createContextMenu () {
|
||||||
if (process.platform === 'darwin' || process.platform === 'win32') {
|
if (process.platform === 'darwin' || process.platform === 'win32') {
|
||||||
const submenu = buildPicBedListMenu()
|
const submenu = buildPicBedListMenu()
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ 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'
|
||||||
@@ -90,6 +91,7 @@ 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()
|
||||||
// 不需要阻塞
|
// 不需要阻塞
|
||||||
@@ -180,15 +182,10 @@ class LifeCycle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async launchApp () {
|
async launchApp () {
|
||||||
const gotTheLock = app.requestSingleInstanceLock()
|
await this.beforeReady()
|
||||||
if (!gotTheLock) {
|
this.onReady()
|
||||||
app.quit()
|
this.onRunning()
|
||||||
} else {
|
this.onQuit()
|
||||||
await this.beforeReady()
|
|
||||||
this.onReady()
|
|
||||||
this.onRunning()
|
|
||||||
this.onQuit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -67,7 +67,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
mac: {
|
mac: {
|
||||||
icon: 'build/icons/icon.icns',
|
icon: 'build/icons/icon.icns',
|
||||||
hardenedRuntime: true,
|
hardenedRuntime: false,
|
||||||
entitlements: 'build/entitlements.mas.plist',
|
entitlements: 'build/entitlements.mas.plist',
|
||||||
entitlementsInherit: 'build/entitlements.mas.inherit.plist',
|
entitlementsInherit: 'build/entitlements.mas.inherit.plist',
|
||||||
provisioningProfile: 'build/piclistmass.provisionprofile',
|
provisioningProfile: 'build/piclistmass.provisionprofile',
|
||||||
@@ -90,7 +90,7 @@ const config = {
|
|||||||
entitlements: 'build/entitlements.mas.plist',
|
entitlements: 'build/entitlements.mas.plist',
|
||||||
entitlementsInherit: 'build/entitlements.mas.inherit.plist',
|
entitlementsInherit: 'build/entitlements.mas.inherit.plist',
|
||||||
provisioningProfile: 'build/piclistmass.provisionprofile',
|
provisioningProfile: 'build/piclistmass.provisionprofile',
|
||||||
entitlementsLoginHelper: "build/entitlements.mas.loginhelper.plist"
|
entitlementsLoginHelper: 'build/entitlements.mas.loginhelper.plist'
|
||||||
},
|
},
|
||||||
win: {
|
win: {
|
||||||
icon: 'build/icons/icon.ico',
|
icon: 'build/icons/icon.ico',
|
||||||
|
|||||||
Reference in New Issue
Block a user